summaryrefslogtreecommitdiff
path: root/src/leap/mx
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
parent833f5a3cb8352cf81962817ec7ed69b982891a80 (diff)
More cleanup
Diffstat (limited to 'src/leap/mx')
-rw-r--r--src/leap/mx/__init__.py20
-rw-r--r--src/leap/mx/tests/__init__.py24
-rw-r--r--src/leap/mx/util/__init__.py12
-rw-r--r--src/leap/mx/util/version.py95
4 files changed, 34 insertions, 117 deletions
diff --git a/src/leap/mx/__init__.py b/src/leap/mx/__init__.py
index 0590c90..efb28ae 100644
--- a/src/leap/mx/__init__.py
+++ b/src/leap/mx/__init__.py
@@ -1,7 +1,21 @@
-#-*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
+# __init__.py
+# Copyright (C) 2013 LEAP
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
"""
-leap/mx/__init__.py
--------------------
Module initialization file for leap.mx .
"""
from leap.mx.util import version
diff --git a/src/leap/mx/tests/__init__.py b/src/leap/mx/tests/__init__.py
index 0416769..2002c48 100644
--- a/src/leap/mx/tests/__init__.py
+++ b/src/leap/mx/tests/__init__.py
@@ -1,13 +1,23 @@
-#-*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
+# start_mx.py
+# Copyright (C) 2013 LEAP
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
"""
-leap/mx/tests/__init__.py
--------------------------
Module intialization file for leap.mx.tests, a module containing unittesting
code, using twisted.trial, for testing leap_mx.
-
-@authors: Isis Agora Lovecruft, <isis@leap.se> 0x2cdb8b35
-@license: AGPLv3, see included LICENSE file
-@copyright: © 2013 Isis Lovecruft, see COPYLEFT file
"""
__all__ = ['test_alias_resolver']
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."