summaryrefslogtreecommitdiff
path: root/src/leap/mx/util
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-04-25 12:04:55 -0300
committerTomas Touceda <chiiph@leap.se>2013-05-07 14:02:12 -0300
commite7756fef684fce2b09494222edff72bf06447aa2 (patch)
treeaf8a01c386cf00ba9435268c0fbd7f37d87c8fdc /src/leap/mx/util
parent833f5a3cb8352cf81962817ec7ed69b982891a80 (diff)
More cleanup
Diffstat (limited to 'src/leap/mx/util')
-rw-r--r--src/leap/mx/util/__init__.py12
-rw-r--r--src/leap/mx/util/version.py95
2 files changed, 0 insertions, 107 deletions
diff --git a/src/leap/mx/util/__init__.py b/src/leap/mx/util/__init__.py
deleted file mode 100644
index c4a93b8..0000000
--- a/src/leap/mx/util/__init__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#-*- encoding: utf-8 -*-
-"""
-leap/mx/util/__init__.py
-------------------------
-Module intialization file for leap.mx.util.
-"""
-
-import version
-version = version.Version()
-
-__all__ = ['config', 'log', 'net', 'storage', 'version']
-
diff --git a/src/leap/mx/util/version.py b/src/leap/mx/util/version.py
deleted file mode 100644
index c32166f..0000000
--- a/src/leap/mx/util/version.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-version.py
-----------
-Version information for leap_mx.
-
-@authors: Isis Agora Lovecruft, <isis@leap.se> 0x2cdb8b35
-@licence: see included LICENSE file
-@copyright: 2013 Isis Agora Lovecruft
-'''
-
-from os import getcwd
-from os import path as ospath
-
-import sys
-
-
-class Version(object):
- def __init__(self):
- self.name = 'leap_mx'
- self.version = '0.0.2'
- self.pipfile = ospath.join(self.getRepoDir(),
- 'pkg/mx-requirements.pip')
- self.authors = [
- ('Isis Agora Lovecruft', '<isis@leap.se>', '0x2cdb8b35'),
- ]
- self.git_url = 'https://github.com/isislovecruft/leap_mx/'
- self.website = 'https://leap.se'
-
- def getPackageName(self):
- """Returns the application name."""
- return self.name
-
- def getPipfile(self):
- """Returns the full path of the pip requirements.txt file."""
- return self.pipfile
-
- def getVersion(self):
- """Returns a version the application name and version number."""
- return self.version
-
- def getAuthors(self):
- credits = str()
- for author in self.authors:
- credits += " ".join(author)
- return credits
-
- def getRepoDir(self):
- """Get the top-level repository directory."""
- here = getcwd()
- base = here.rsplit(self.name, 1)[0]
- repo = ospath.join(base, self.name)
- return repo
-
- def __make_text__(self, extra_text=None):
- splitr = "-" * len(self.version.__str__())
- header = ["\n%s\n" % self.version.__str__(),
- "%s\n" % splitr]
- footer = ["Website: \t%s\n" % self.website,
- "Github: \t%s\n" % self.git_url,
- "\n"]
- contacts = ["\t%s, %s %s\n"
- % (a[0], a[1], a[2]) for a in self.authors]
- contacts.insert(0, "Authors: ")
-
- with_contacts = header + contacts
-
- if extra_text is not None:
- if isinstance(extra_text, iter):
- with_contacts.extend((e for e in extra_text))
- elif isinstance(extra_text, str):
- with_contacts.append(extra_text)
- else:
- print "Couldn't add extra text..."
-
- text = with_contacts + footer
- return text
-
- def __update_version__(self):
- repo = self.getRepoDir()
- self.version_file = ospath.join(repo, 'VERSION')
- version_text = self.__make_text__()
-
- with open(self.version_file, 'w+') as fh:
- fh.writelines((line for line in version_text))
- fh.flush()
- fh.truncate()
-
-
-if __name__ == "__main__":
- print "Generating new VERSION file..."
- vrsn = Version()
- vrsn.__update_version__()
- print "Done."