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

Tii*_*ina 8 python

github下载的 tosca-parser ,在使用时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.
Run Code Online (Sandbox Code Playgroud)

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

Lev*_*von 11

禁用 pbr 设置PBR_VERSION的所有版本计算逻辑

\n
$ export PBR_VERSION=1.2.3 \n$ python setup.py sdist\n
Run Code Online (Sandbox Code Playgroud)\n

或在一根线上

\n
$ PBR_VERSION=1.2.3 python setup.py sdist\n
Run Code Online (Sandbox Code Playgroud)\n

根据pbr 文档

\n
\n

pbr 在 git 存储库中运行时,会从 git 标签派生包的版本。当使用正确的 Egg-info 目录在 tarball 中运行时,它会很乐意从中提取版本。因此,在大多数情况下,软件包维护者不应该\xe2\x80\x99 需要关心。但是,如果您正在做类似将源代码和打包混合在一起的 git 存储库,并且 it\xe2\x80\x99s 导致 pbr 对其是否在自己的 git 存储库中感到困惑,您可以设置PBR_VERSION

\n
\n