def test_get_entrypoints(tmpdir): with open(str(tmpdir.join("entry_points.txt")), "w") as fp: fp.write( """ [console_scripts] pip = pip.main:pip """ ) assert wheel.get_entrypoints(str(tmpdir.join("entry_points.txt"))) == ({"pip": "pip.main:pip"}, {})
def test_get_entrypoints(tmpdir): with open(str(tmpdir.join("entry_points.txt")), "w") as fp: fp.write(""" [console_scripts] pip = pip.main:pip """) assert wheel.get_entrypoints(str(tmpdir.join("entry_points.txt"))) == ( {"pip": "pip.main:pip"}, {}, )
def test_get_entrypoints(tmpdir, console_scripts): entry_points = tmpdir.join("entry_points.txt") with open(str(entry_points), "w") as fp: fp.write(""" [console_scripts] {0} [section] common:one = module:func common:two = module:other_func """.format(console_scripts)) assert wheel.get_entrypoints(str(entry_points)) == ( dict([console_scripts.split(' = ')]), {}, )
def _project_info(requirement_set): """ get project info from requirement_set :param requirement_set: `pip.req.RequirementSet` :return: (paths, entry_points): project sys.path's string and entry_points """ paths = ["."] editable_req = None for req in requirement_set.requirements.values(): if req.editable: editable_req = req continue else: path = os.path.join("target/wheels", req.link.filename) paths.append(path) path_strings = '\n'.join( [" join(base, '{path}'),".format(path=p) for p in paths]) entry_points_path = editable_req.egg_info_path("entry_points.txt") entry_points = get_entrypoints(entry_points_path)[0] return path_strings, entry_points