diff options
| author | Matt Rendina <mrendina@stsci.edu> | 2017-05-23 11:53:21 -0400 | 
|---|---|---|
| committer | Matt Rendina <mrendina@stsci.edu> | 2017-05-23 11:53:21 -0400 | 
| commit | b3e82911587c49863a4dab105aa139f61e53945f (patch) | |
| tree | 460cd786d51fd647473429e7d46a5b207a23b162 | |
| parent | 43ce44715858ee56b3fe0652ad6645f6643dcc99 (diff) | |
| download | rambo-b3e82911587c49863a4dab105aa139f61e53945f.tar.gz | |
Turning into a package
| -rw-r--r-- | rambo/__init__.py | 0 | ||||
| -rw-r--r-- | rambo/_version.py | 1 | ||||
| -rwxr-xr-x | rambo/rambo.py (renamed from rambo.py) | 41 | ||||
| -rw-r--r-- | setup.cfg | 6 | ||||
| -rw-r--r-- | setup.py | 28 | 
5 files changed, 69 insertions, 7 deletions
| diff --git a/rambo/__init__.py b/rambo/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rambo/__init__.py diff --git a/rambo/_version.py b/rambo/_version.py new file mode 100644 index 0000000..a655b17 --- /dev/null +++ b/rambo/_version.py @@ -0,0 +1 @@ +__version__ = '1.0.0b1' diff --git a/rambo.py b/rambo/rambo.py index 13cd51c..998c2f8 100755 --- a/rambo.py +++ b/rambo/rambo.py @@ -3,9 +3,11 @@  '''  RAMBO - Recipe Analyzer and Multi-package Build Optimizer -Requires conda to be installed on the PATH in order to access the API -machinery via 'conda_build.api. +Requires conda & conda-build to be installed in a path that appears in the +python interprer's search list in order to access the API machinery via +'conda_build.api.  ''' +  from __future__ import print_function  import os  import sys @@ -15,7 +17,17 @@ from six.moves import urllib  import codecs  from yaml import safe_load  import json -import conda_build.api +from rambo._version import __version__ +try: +    import conda_build.api +except ImportError: +    raise ImportError('conda-build must be installed order to use this \n' +                      'tool. Either conda-build is not installed, or you \n' +                      'are working in an activated conda environment. \n' +                      'If conda-build is installed deactivate the \n' +                      'environment currently enabled or explicitly switch \n' +                      'to the conda "root" environment to allow use of\n' +                      'conda-build.')  DEFAULT_MINIMUM_NUMPY_VERSION = '1.11' @@ -334,6 +346,7 @@ class metaSet(object):      def print_details(self, fh=sys.stdout):          num_notOK = 0 +        print('conda-build version     : ', conda_build.__version__)          print('Python version specified: ', self.versions['python'])          print('Numpy  version specified: ', self.versions['numpy'])          print('                              num  num      peer', file=fh) @@ -390,15 +403,19 @@ class metaSet(object):  # ---- -def main(argv): +def main(argv=None): + +    if argv is None: +        argv = sys.argv -    parser = argparse.ArgumentParser() +    parser = argparse.ArgumentParser(prog='rambo')      parser.add_argument('-p', '--platform', type=str)      parser.add_argument(              '--python',              type=str,              help='Python version to pass to conda machinery when rendering ' -            'recipes. "#.#" format.') +            'recipes. "#.#" format. If not specified, the version of python' +            ' hosting conda_build.api is used.')      parser.add_argument(              '-m',              '--manifest', @@ -429,9 +446,19 @@ def main(argv):              'each recipe instead of creating a new one. If a work directory '              'does not already exist, the recipe is processed in the normal '              'fashion. Used mostly for testing purposes.') +    parser.add_argument( +            '-v', +            '--version', +            action='version', +            version='%(prog)s ' + __version__, +            help='Display version information.')      parser.add_argument('recipes_dir', type=str)      args = parser.parse_args() +    if args.version: +        print(__version__) +        os.exit(0) +      recipes_dir = os.path.normpath(args.recipes_dir)      fh = None @@ -463,4 +490,4 @@ def main(argv):          mset.print(fh)  if __name__ == "__main__": -    main(sys.argv) +    main() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d6ad6c3 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +# This flag says that the code is written to work on both Python 2 and Python +# 3. If at all possible, it is good practice to do this. If you cannot, you +# will need to generate wheels for each Python version that you support. +universal=1 + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..454329f --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +from setuptools import setup, find_packages + +version = {} +with open("rambo/_version.py") as fp: +        exec(fp.read(), version) +        # later on use: version['__version__'] + +setup( +    name='rambo', +    version=version['__version__'], +    author='Matt Rendina', +    author_email='mrendina@stsci.edu', +    description='Recipe Analyzer and Multi-package Build Optimizer', +    url='https://github.com/astroconda/rambo', +    license='GPLv2', +    classifiers=[ +        'License :: OSI Approved :: BSD License', +        'Operating System :: OS Independent', +        'Programming Language :: Python', +        'Natural Language :: English', +        'Topic :: Software Development :: Build Tools', +    ], +    packages=find_packages(), +    package_data={'': ['README.md', 'LICENSE.txt']}, +    entry_points = { +        'console_scripts': ['rambo=rambo.rambo:main'], +    } +) | 
