rexzhang / asgi-webdav

An asynchronous WebDAV server implementation, Support multi-provider, multi-account and permission control.
https://rexzhang.github.io/asgi-webdav/
MIT License
75 stars 14 forks source link

自行打包报错 #48

Closed devome closed 5 months ago

devome commented 5 months ago

Arch Linux使用系统本地Python 3.12,已在系统本地中安装好setuptools build wheel这几个pip包(不是虚拟环境),然后在仓库根目录执行python -m build --wheel --no-isolation -v来打包,但是报错:

* Getting build dependencies for wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/packaging/requirements.py", line 35, in __init__
    parsed = _parse_requirement(requirement_string)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 64, in parse_requirement
    return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 73, in _parse_requirement
    name_token = tokenizer.expect(
                 ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/_tokenizer.py", line 140, in expect
    raise self.raise_syntax_error(f"Expected {expected}")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/_tokenizer.py", line 165, in raise_syntax_error
    raise ParserSyntaxError(
packaging._tokenizer.ParserSyntaxError: Expected package name at the start of dependency specifier
    -r basic.txt
    ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in <module>
    main()
  File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 357, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 134, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 159, in setup
    dist.parse_config_files()
  File "/usr/lib/python3.12/site-packages/setuptools/dist.py", line 627, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/usr/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 73, in apply_configuration
    return _apply(dist, config, filepath)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 62, in apply
    dist._finalize_requires()
  File "/usr/lib/python3.12/site-packages/setuptools/dist.py", line 364, in _finalize_requires
    self._normalize_requires()
  File "/usr/lib/python3.12/site-packages/setuptools/dist.py", line 381, in _normalize_requires
    k: list(map(str, _reqs.parse(v or []))) for k, v in extras_require.items()
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/requirements.py", line 37, in __init__
    raise InvalidRequirement(str(e)) from e
packaging.requirements.InvalidRequirement: Expected package name at the start of dependency specifier
    -r basic.txt
    ^

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
rexzhang commented 5 months ago

刚刚我在macOS(Py3.12.3)测试了python -m build --wheel --no-isolation -v,能够正常打包.会不会是系统环境或者工具版本问题?试试用python -m venv venv创建一个虚环境试试?

另外,开报错的日志,应该是对requirements中的-r basic.txt这种格式解析错误

devome commented 5 months ago

建了个虚拟环境,还是提示一样的错误。难道Arch Linux不支持读取-r来打包?

rexzhang commented 5 months ago

我在Debian(AMD64)12.5/python3.11.2环境下用完全一样的命令测试了下,也是没有问题的

~/asgi-webdav# uname -a
Linux test 6.6.29-production+truenas #1 SMP PREEMPT_DYNAMIC Wed May 29 15:05:57 UTC 2024 x86_64 GNU/Linux

~/asgi-webdav# cat /etc/debian_version
12.5

~/asgi-webdav# python3 --version
Python 3.11.2

~/asgi-webdav# pip list
Package         Version
--------------- -------
build           1.2.1
packaging       24.1
pip             23.0.1
pyproject_hooks 1.1.0
setuptools      70.0.0
wheel           0.43.0
devome commented 5 months ago

我知道了,我先 git checkout v1.4.0到v1.4.0这个tag下去了,在这个tag下不能成功打包,只有在main主线分支下打包才行。

rexzhang commented 5 months ago

这有点奇怪,不过也不用管了

devome commented 5 months ago

用过这么多webdav服务程序,还是你的功能最全最好用。

经过努力,终于把asgi-webdav打包到AUR上了,其中asgi-webdav如果使用github上的tag,需要加上这个补丁,索性最后直接用pypi上的压缩包了。

https://aur.archlinux.org/packages/python-asgi-middleware-static-file https://aur.archlinux.org/packages/python-asgi-webdav

现在Arch Linux用户可以直接一句命令安装了:paru -S python-asgi-webdav

devome commented 5 months ago

顺便想问一下,如果不安装 uvicorn uvloop httptools这三个包会有什么影响吗?我看它们在pyproject.toml中是可选项,我没装好像也能跑?

rexzhang commented 5 months ago

你的目的是什么?如果只是使用库,直接 pip 安装即可

devome commented 5 months ago

Arch Linux 的依赖申明,一类是必须的依赖,一类是可选依赖。具体的文件在这里:https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-asgi-webdav 。Arch Linux如果安装在系统中不能使用pip来安装。

rexzhang commented 5 months ago

如果你需要深入讨论,可以专门开一个issue,或者重新打开这个,现在这样很奇怪

rexzhang commented 5 months ago

另外,可能是大半夜的原因,漏看了你是为了「把asgi-webdav打包到AUR上」

我把 issue 重新打开了,如果交流完毕你可以自行关闭

devome commented 5 months ago

好的,我明白了,那我现在的打包方式是合理的,谢谢了。