diff options
| -rw-r--r-- | docs/conf.py | 20 | ||||
| -rw-r--r-- | src/leap/bitmask/__init__.py | 75 | ||||
| -rw-r--r-- | src/leap/bitmask/util/__init__.py | 50 | ||||
| -rw-r--r-- | src/leap/bitmask/util/leap_argparse.py | 6 | 
4 files changed, 91 insertions, 60 deletions
| diff --git a/docs/conf.py b/docs/conf.py index 39f17d9b..082b4d67 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,11 +18,12 @@ import sys, os  # documentation root, use os.path.abspath to make it absolute, like shown here.  sys.path.insert(0, os.path.abspath('../src'))  sys.path.insert(0, os.path.abspath('../src/leap')) -sys.path.insert(0, os.path.abspath('../src/leap/crypto')) -sys.path.insert(0, os.path.abspath('../src/leap/keymanager')) -sys.path.insert(0, os.path.abspath('../src/leap/services')) -sys.path.insert(0, os.path.abspath('../src/leap/services/eip')) -sys.path.insert(0, os.path.abspath('../src/leap/util')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/crypto')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/keymanager')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/services/eip')) +sys.path.insert(0, os.path.abspath('../src/leap/bitmask/util'))  sys.path.insert(0, os.path.abspath(      os.path.expanduser( @@ -58,17 +59,18 @@ source_suffix = '.rst'  master_doc = 'index'  # General information about the project. -project = u'LEAP' -copyright = u'2012, The LEAP Encryption Access Project' +project = u'Bitmask' +copyright = u'2012-2013, The LEAP Encryption Access Project'  # The version info for the project you're documenting, acts as replacement for  # |version| and |release|, also used in various other places throughout the  # built documents.  #  # The short X.Y version. -version = '0.2.1-dev1' +import leap.bitmask +version = leap.bitmask.__short_version__  # The full version, including alpha/beta/rc tags. -release = '0.2.1' +release = leap.bitmask.__version__  # The language for content autogenerated by Sphinx. Refer to documentation  # for a list of supported languages. diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py index e69de29b..ebdd53c4 100644 --- a/src/leap/bitmask/__init__.py +++ b/src/leap/bitmask/__init__.py @@ -0,0 +1,75 @@ +# -*- coding: 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/>. +""" +Init file for leap.bitmask + +Initializes version and app info. +""" +import re + +from pkg_resources import parse_version + +from leap.bitmask.util import first + + +def _is_release_version(version): +    """ +    Helper to determine whether a version is a final release or not. +    The release needs to be of the form: w.x.y.z containing only numbers +    and dots. + +    :param version: the version string +    :type version: str +    :returns: if the version is a release version or not. +    :rtype: bool +    """ +    parsed_version = parse_version(version) +    not_number = 0 +    for x in parsed_version: +        try: +            int(x) +        except: +            not_number += 1 + +    return not_number == 1 + + +__version__ = "unknown" +IS_RELEASE_VERSION = False + +__short_version__ = "unknown" + +try: +    from leap.bitmask._version import get_versions +    __version__ = get_versions()['version'] +    IS_RELEASE_VERSION = _is_release_version(__version__) +    del get_versions +except ImportError: +    #running on a tree that has not run +    #the setup.py setver +    pass + +__appname__ = "unknown" +try: +    from leap._appname import __appname__ +except ImportError: +    #running on a tree that has not run +    #the setup.py setver +    pass + +__short_version__ = first(re.findall('\d\.\d\.\d', __version__)) +__full_version__ = __appname__ + '/' + str(__version__) diff --git a/src/leap/bitmask/util/__init__.py b/src/leap/bitmask/util/__init__.py index ce8323cd..6dd18bcf 100644 --- a/src/leap/bitmask/util/__init__.py +++ b/src/leap/bitmask/util/__init__.py @@ -15,59 +15,11 @@  # You should have received a copy of the GNU General Public License  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  """ -Initializes version and app info, plus some small and handy functions. +Some small and handy functions.  """  import datetime  import os -from pkg_resources import parse_version - - -def _is_release_version(version): -    """ -    Helper to determine whether a version is a final release or not. -    The release needs to be of the form: w.x.y.z containing only numbers -    and dots. - -    :param version: the version string -    :type version: str -    :returns: if the version is a release version or not. -    :rtype: bool -    """ -    parsed_version = parse_version(version) -    not_number = 0 -    for x in parsed_version: -        try: -            int(x) -        except: -            not_number += 1 - -    return not_number == 1 - - -__version__ = "unknown" -IS_RELEASE_VERSION = False - -try: -    from leap.bitmask._version import get_versions -    __version__ = get_versions()['version'] -    IS_RELEASE_VERSION = _is_release_version(__version__) -    del get_versions -except ImportError: -    #running on a tree that has not run -    #the setup.py setver -    pass - -__appname__ = "unknown" -try: -    from leap._appname import __appname__ -except ImportError: -    #running on a tree that has not run -    #the setup.py setver -    pass - -__full_version__ = __appname__ + '/' + str(__version__) -  def first(things):      """ diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py index 71f5163d..bc21a9cf 100644 --- a/src/leap/bitmask/util/leap_argparse.py +++ b/src/leap/bitmask/util/leap_argparse.py @@ -14,10 +14,12 @@  #  # You should have received a copy of the GNU General Public License  # along with this program.  If not, see <http://www.gnu.org/licenses/>. - +""" +Parses the command line arguments passed to the application. +"""  import argparse -from leap.bitmask.util import IS_RELEASE_VERSION +from leap.bitmask import IS_RELEASE_VERSION  def build_parser(): | 
