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)
Exemple #2
0
    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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
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)
Exemple #6
0
 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"])
 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"])
Exemple #10
0
 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"])
Exemple #11
0
<<<<<<< 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'):