diff options
-rw-r--r-- | rambo/__init__.py | 6 | ||||
-rw-r--r-- | rambo/__main__.py | 97 | ||||
-rwxr-xr-x | rambo/rambo.py | 29 | ||||
-rw-r--r-- | setup.py | 4 |
4 files changed, 114 insertions, 22 deletions
diff --git a/rambo/__init__.py b/rambo/__init__.py index e69de29..3a180c1 100644 --- a/rambo/__init__.py +++ b/rambo/__init__.py @@ -0,0 +1,6 @@ +__all__ = ["rambo"] + +from .rambo import __version__ +from .rambo import Meta +from .rambo import MetaSet + diff --git a/rambo/__main__.py b/rambo/__main__.py new file mode 100644 index 0000000..e7173be --- /dev/null +++ b/rambo/__main__.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python + +''' +RAMBO - Recipe Analyzer and Multi-package Build Optimizer +''' + +import os +import sys +import argparse +from . import rambo +#from ._version import __version__ +#from .rambo import * + +def main(argv=None): + + if argv is None: + argv = sys.argv + + 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. If not specified, the version of python' + ' hosting conda_build.api is used.') + parser.add_argument( + '-m', + '--manifest', + type=str, + help='Use this file to filter the list of recipes to process.') + parser.add_argument( + '-f', + '--file', + type=str, + help='Send package list output to this file instead of stdout.') + parser.add_argument( + '-c', + '--culled', + action='store_true', + help='Print the ordered list of package names reduced to the set' + ' of packages that do not already exist in the channel specified' + ' in the supplied manifest file.') + parser.add_argument( + '-d', + '--details', + action='store_true', + help='Display details used in determining build order and/or ' + 'package culling.') + parser.add_argument( + '--dirty', + action='store_true', + help='Use the most recent pre-existing conda work directory for ' + '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 ' + rambo.__version__, + help='Display version information.') + parser.add_argument('recipes_dir', type=str) + args = parser.parse_args() + + recipes_dir = os.path.normpath(args.recipes_dir) + + fh = None + if args.file: + fh = open(args.file, 'w') + + versions = {'python': '', 'numpy': ''} + if args.python: + versions['python'] = args.python + + versions['numpy'] = rambo.DEFAULT_MINIMUM_NUMPY_VERSION + + mset = rambo.MetaSet( + recipes_dir, + platform=args.platform, + versions=versions, + dirty=args.dirty, + manfile=args.manifest) + + mset.multipass_optimize() + + if args.details: + mset.print_details(fh) + if mset.channel: + mset.print_status_in_channel(fh) + elif args.culled: + mset.print_culled(fh) + else: + mset.print(fh) + +if __name__ == "__main__": + main() diff --git a/rambo/rambo.py b/rambo/rambo.py index 998c2f8..ad811f7 100755 --- a/rambo/rambo.py +++ b/rambo/rambo.py @@ -1,8 +1,6 @@ #!/usr/bin/env python ''' -RAMBO - Recipe Analyzer and Multi-package Build Optimizer - 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. @@ -17,7 +15,7 @@ from six.moves import urllib import codecs from yaml import safe_load import json -from rambo._version import __version__ +from ._version import __version__ try: import conda_build.api except ImportError: @@ -32,7 +30,7 @@ except ImportError: DEFAULT_MINIMUM_NUMPY_VERSION = '1.11' -class meta(object): +class Meta(object): '''Holds metadata for a recipe obtained from the recipe's meta.yaml file, certain values derived from that data, and methods to calculate those derived values.''' @@ -121,7 +119,7 @@ class meta(object): numpy=self.versions['numpy'])) -class metaSet(object): +class MetaSet(object): '''A collection of mulitple recipe metadata objects from a directory specification, and methods for manipulationg and querying this collection.''' @@ -144,6 +142,7 @@ class metaSet(object): self.versions = versions self.manfile = manfile self.manifest = None + self.channel = None if self.manfile: self.read_manifest() self.filter_by_manifest() @@ -158,22 +157,6 @@ class metaSet(object): self.channel_data = self.get_channel_data() self.flag_archived() - def read_recipes_old(self, directory): - '''Process a directory reading in each conda recipe found, creating - a list of metadata objects for use in analyzing the collection of - recipes as a whole.''' - recipe_dirnames = os.listdir(directory) - for rdirname in recipe_dirnames: - if rdirname in self.ignore_dirs: - continue - rdir = directory + '/' + rdirname - m = meta(rdir, versions=self.versions, dirty=self.dirty) - if m.complete: - self.metas.append(m) - self.names.append(m.name) - else: - self.incomplete_metas.append(m) - def read_recipe_selection(self, directory, recipe_list): '''Process a directory reading in each conda recipe found, creating a list of metadata objects for use in analyzing the collection of @@ -182,7 +165,7 @@ class metaSet(object): if rdirname in self.ignore_dirs: continue rdir = directory + '/' + rdirname - m = meta(rdir, versions=self.versions, dirty=self.dirty) + m = Meta(rdir, versions=self.versions, dirty=self.dirty) if m.complete: self.metas.append(m) self.names.append(m.name) @@ -398,6 +381,8 @@ class metaSet(object): print('{0:>50} {1}'.format( meta.canonical_name, statstr[meta.archived]), file=fh) +<<<<<<< HEAD:rambo/rambo.py +======= # ---- @@ -23,6 +23,10 @@ setup( packages=find_packages(), package_data={'': ['README.md', 'LICENSE.txt']}, entry_points = { +<<<<<<< HEAD + 'console_scripts': ['rambo=rambo.__main__:main'], +======= 'console_scripts': ['rambo=rambo.rambo:main'], +>>>>>>> 6b9eeaf9321223e15c37b53effe75118aed9ef5d } ) |