此项目的python setup.py sdist错误版本控制需要sdist tarball或访问上游git存储库

2024-06-16 11:37:39 发布

您现在位置:Python中文网/ 问答频道 /正文

github下载的tosca解析器在使用python setup.py develop时会抱怨:此项目的版本控制需要sdist tarball,或者访问上游git存储库。因此我使用python setup.py sdist,错误是相同的:

ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/usr/lib/python2.7/site-packages/pbr/util.py", line 270, in cfg_to_args
    pbr.hooks.setup_hook(config)
  File "/usr/lib/python2.7/site-packages/pbr/hooks/__init__.py", line 25, in setup_hook
    metadata_config.run()
  File "/usr/lib/python2.7/site-packages/pbr/hooks/base.py", line 27, in run
    self.hook()
  File "/usr/lib/python2.7/site-packages/pbr/hooks/metadata.py", line 26, in hook
    self.config['name'], self.config.get('version', None))
  File "/usr/lib/python2.7/site-packages/pbr/packaging.py", line 874, in get_version
    name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name tosca-parser was given, but was not able to be found.
error in setup command: Error parsing /home/tiina/tosca/tosca-parser-master/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name tosca-parser was given, but was not able to be found.

我在git init之后运行相同的命令,然后错误就消失了。我不明白的是,它需要一个上游git存储库


Tags: tonameinpygitlibpackagesusr
1条回答
网友
1楼 · 发布于 2024-06-16 11:37:39

禁用pbr集合的所有版本计算逻辑pbr\u版本

$ export PBR_VERSION=1.2.3 
$ python setup.py sdist

还是在一条线上

$ PBR_VERSION=1.2.3 python setup.py sdist

根据pbr docs

pbr, when run in a git repo, derives the version of a package from the git tags. When run in a tarball with a proper egg-info dir, it will happily pull the version from that. So for the most part, the package maintainers shouldn’t need to care. However, if you are doing something like keeping a git repo with the sources and the packaging intermixed and it’s causing pbr to get confused about whether its in its own git repo or not, you can set PBR_VERSION

相关问题 更多 >