本文整理汇总了Python中pkginfo.Wheel方法的典型用法代码示例。如果您正苦于以下问题:Python pkginfo.Wheel方法的具体用法?Python pkginfo.Wheel怎么用?Python pkginfo.Wheel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pkginfo
的用法示例。
在下文中一共展示了pkginfo.Wheel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_dist_info
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def get_dist_info(wheel_dir: str) -> str:
""""Returns the relative path to the dist-info directory if it exists.
Args:
wheel_dir: The root of the extracted wheel directory.
Returns:
Relative path to the dist-info directory if it exists, else, None.
"""
dist_info_dirs = glob.glob(os.path.join(wheel_dir, "*.dist-info"))
if not dist_info_dirs:
raise ValueError(
"No *.dist-info directory found. %s is not a valid Wheel." % wheel_dir
)
if len(dist_info_dirs) > 1:
raise ValueError(
"Found more than 1 *.dist-info directory. %s is not a valid Wheel."
% wheel_dir
)
return dist_info_dirs[0]
示例2: get_dot_data_directory
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def get_dot_data_directory(wheel_dir: str) -> Optional[str]:
"""Returns the relative path to the data directory if it exists.
See: https://www.python.org/dev/peps/pep-0491/#the-data-directory
Args:
wheel_dir: The root of the extracted wheel directory.
Returns:
Relative path to the data directory if it exists, else, None.
"""
dot_data_dirs = glob.glob(os.path.join(wheel_dir, "*.data"))
if not dot_data_dirs:
return None
if len(dot_data_dirs) > 1:
raise ValueError(
"Found more than 1 *.data directory. %s is not a valid Wheel." % wheel_dir
)
return dot_data_dirs[0]
示例3: get_nni_meta
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def get_nni_meta(source):
if not os.path.exists(source):
print_error('{} does not exist'.format(source))
return None
if os.path.isdir(source):
if not os.path.exists(os.path.join(source, 'setup.py')):
print_error('setup.py not found')
return None
pkg = pkginfo.Develop(source)
else:
if not source.endswith('.whl'):
print_error('File name {} must ends with \'.whl\''.format(source))
return False
pkg = pkginfo.Wheel(source)
classifiers = pkg.classifiers
meta = parse_classifiers(classifiers)
meta['package_name'] = pkg.name
return meta
示例4: inspect_wheel
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def inspect_wheel(
self, file_path
): # type: (Path) -> Dict[str, Union[str, List[str]]]
info = {
"name": "",
"version": "",
"summary": "",
"requires_python": None,
"requires_dist": [],
}
try:
meta = pkginfo.Wheel(str(file_path))
except ValueError:
# Unable to determine dependencies
# Assume none
return info
if meta.name:
info["name"] = meta.name
if meta.version:
info["version"] = meta.version
if meta.summary:
info["summary"] = meta.summary or ""
info["requires_python"] = meta.requires_python
if meta.requires_dist:
info["requires_dist"] = meta.requires_dist
return info
示例5: test_download
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_download():
project1_sdist = create_sdist(name='project1',
version='1.0.0',
extras_require={'foo': ['project2']})
project2_wheel = build_wheel(name='project2',
version='2.0.0',
# This is the last version of setuptools compatible with Python 2.7.
install_reqs=['setuptools==44.1.0'])
downloaded_by_target = defaultdict(list)
for local_distribution in download(requirements=['{}[foo]'.format(project1_sdist)],
find_links=[os.path.dirname(project2_wheel)]):
distribution = pkginfo.get_metadata(local_distribution.path)
downloaded_by_target[local_distribution.target].append(distribution)
assert 1 == len(downloaded_by_target)
target, distributions = downloaded_by_target.popitem()
assert DistributionTarget.current() == target
distributions_by_name = {distribution.name: distribution for distribution in distributions}
assert 3 == len(distributions_by_name)
def assert_dist(project_name, dist_type, version):
dist = distributions_by_name[project_name]
assert dist_type is type(dist)
assert version == dist.version
assert_dist('project1', pkginfo.SDist, '1.0.0')
assert_dist('project2', pkginfo.Wheel, '2.0.0')
assert_dist('setuptools', pkginfo.Wheel, '44.1.0')
示例6: test_grpc_whl
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_grpc_whl(self):
td = pkginfo.Wheel(
TestData("grpc_whl/file/grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl")
)
self.assertEqual(
set(whl.dependencies(td)), set(["enum34", "futures", "protobuf", "six"])
)
示例7: test_futures_whl
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_futures_whl(self):
td = pkginfo.Wheel(
TestData("futures_3_1_1_whl/file/futures-3.1.1-py2-none-any.whl")
)
self.assertEqual(set(whl.dependencies(td)), set())
示例8: test_whl_with_METADATA_file
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_whl_with_METADATA_file(self):
td = pkginfo.Wheel(
TestData("futures_2_2_0_whl/file/futures-2.2.0-py2.py3-none-any.whl")
)
self.assertEqual(set(whl.dependencies(td)), set())
示例9: test_mock_whl
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_mock_whl(self, *args):
td = pkginfo.Wheel(TestData("mock_whl/file/mock-2.0.0-py2.py3-none-any.whl"))
self.assertEqual(set(whl.dependencies(td)), set(["funcsigs", "pbr", "six"]))
示例10: test_mock_whl_extras
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_mock_whl_extras(self, *args):
td = pkginfo.Wheel(TestData("mock_whl/file/mock-2.0.0-py2.py3-none-any.whl"))
self.assertEqual(set(whl.dependencies(td, extra="docs")), set(["sphinx"]))
self.assertEqual(set(whl.dependencies(td, extra="test")), set(["unittest2"]))
示例11: test_mock_whl_extras_3_0
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_mock_whl_extras_3_0(self, *args):
td = pkginfo.Wheel(TestData("mock_whl/file/mock-2.0.0-py2.py3-none-any.whl"))
self.assertEqual(
set(whl.dependencies(td, extra="docs")),
set(["sphinx", "Pygments", "jinja2"]),
)
self.assertEqual(set(whl.dependencies(td, extra="test")), set(["unittest2"]))
示例12: test_google_cloud_language_whl
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_google_cloud_language_whl(self, *args):
td = pkginfo.Wheel(
TestData(
"google_cloud_language_whl/file/google_cloud_language-0.29.0-py2.py3-none-any.whl"
)
)
expected_deps = [
"google-gax",
"google-cloud-core",
"googleapis-common-protos[grpc]",
"enum34",
]
self.assertEqual(set(whl.dependencies(td)), set(expected_deps))
示例13: test_google_cloud_language_whl_3_4
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_google_cloud_language_whl_3_4(self, *args):
td = pkginfo.Wheel(
TestData(
"google_cloud_language_whl/file/google_cloud_language-0.29.0-py2.py3-none-any.whl"
)
)
expected_deps = [
"google-gax",
"google-cloud-core",
"googleapis-common-protos[grpc]",
]
self.assertEqual(set(whl.dependencies(td)), set(expected_deps))
示例14: test_pytest_flask_whl
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def test_pytest_flask_whl(self, *args):
td = pkginfo.Wheel(
TestData(
"pytest_flask_0_14_0_whl/file/pytest_flask-0.14.0-py2.py3-none-any.whl"
)
)
expected_deps = [
"pytest",
"Flask",
"Werkzeug",
]
self.assertEqual(len(whl.dependencies(td)), len(expected_deps))
self.assertEqual(set(whl.dependencies(td)), set(expected_deps))
示例15: metadata
# 需要导入模块: import pkginfo [as 别名]
# 或者: from pkginfo import Wheel [as 别名]
def metadata(self) -> pkginfo.Wheel:
return pkginfo.get_metadata(self.path)