def setUp(self): from pkg_resources import EntryPoint spec = """ ep1=crushinator.framework.tests.test_aggregator:dummy_entry_point ep2=crushinator.framework.tests.test_aggregator:dummy_entry_point """ self.runner_entry_points = EntryPoint.parse_group('crushinator.runner', spec) self.collector_entry_points = EntryPoint.parse_group('crushinator.collector', spec)
def run(self): requires = self.distribution.install_requires ep = {} for section, items in self.distribution.entry_points.items(): ep.update(EntryPoint.parse_group(section, items)) requires.append('.') BlueSnow(self.output, self.compress).process(requires, ep)
def driver(source: ('The Python package/directory containing the entry points', 'option') = '.', output: ('The output directory', 'option') = 'bluesnow-out', compress: ('Compress the data', 'flag') = False, *entry_points: 'The list of entry points'): if not entry_points: sys.exit('One or more entry points are required.') ep = EntryPoint.parse_group('entry_points', entry_points) BlueSnow(output, compress).process([source], ep)
def write_entries(cmd, basename, filename): ep = cmd.distribution.entry_points if isinstance(ep, str) or ep is None: data = ep elif ep is not None: data = [] for section, contents in sorted(ep.items()): if not isinstance(contents, str): contents = EntryPoint.parse_group(section, contents) contents = '\n'.join(sorted(map(str, contents.values()))) data.append('[%s]\n%s\n\n' % (section, contents)) data = ''.join(data) cmd.write_or_delete_file('entry points', filename, data, True)
def write_entries(cmd, basename, filename): ep = cmd.distribution.entry_points if isinstance(ep, basestring) or ep is None: data = ep elif ep is not None: data = [] for section, contents in sorted(ep.items()): if not isinstance(contents, basestring): contents = EntryPoint.parse_group(section, contents) contents = '\n'.join(sorted(map(str, contents.values()))) data.append('[%s]\n%s\n\n' % (section, contents)) data = ''.join(data) cmd.write_or_delete_file('entry points', filename, data, True)
def generate_usage(self): old_argv = sys.argv scripts = self.distribution.entry_points["console_scripts"] for pkg in self.distribution.packages: for ep in EntryPoint.parse_group(pkg, scripts).values(): rs = io.StringIO() sys.argv = [None, "--help"] with contextlib.redirect_stdout(rs), contextlib.suppress(SystemExit): ep.resolve()() rs.seek(0) yield "::\n\n" for line in rs.readlines(): yield (" " if line != "\n" else "") + line yield "\n" sys.argv = old_argv yield from []
def testParseList(self): self.checkSubMap(EntryPoint.parse_group("xyz", self.submap_str)) with pytest.raises(ValueError): EntryPoint.parse_group("x a", "foo=bar") with pytest.raises(ValueError): EntryPoint.parse_group("x", ["foo=baz", "foo=bar"])
def testParseList(self): self.checkSubMap(EntryPoint.parse_group("xyz", self.submap_str)) self.assertRaises(ValueError, EntryPoint.parse_group, "x a", "foo=bar") self.assertRaises(ValueError, EntryPoint.parse_group, "x", ["foo=baz", "foo=bar"])
<<<<<<< HEAD if isinstance(ep, six.string_types) or ep is None: ======= if isinstance(ep, str) or ep is None: >>>>>>> 7e5c5fbd6c824de4d4c2b62da3f7cae87d462119 data = ep elif ep is not None: data = [] for section, contents in sorted(ep.items()): <<<<<<< HEAD if not isinstance(contents, six.string_types): ======= if not isinstance(contents, str): >>>>>>> 7e5c5fbd6c824de4d4c2b62da3f7cae87d462119 contents = EntryPoint.parse_group(section, contents) contents = '\n'.join(sorted(map(str, contents.values()))) data.append('[%s]\n%s\n\n' % (section, contents)) data = ''.join(data) cmd.write_or_delete_file('entry points', filename, data, True) def get_pkg_info_revision(): """ Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. """ warnings.warn( "get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning) if os.path.exists('PKG-INFO'):