pyarmor:无法使用 build_meta 构建

pyarmor: unable to build using build_meta

我正在尝试使用 build-pyarmored-wheel 构建公司项目,我正在按照 https://pyarmor.readthedocs.io/en/latest/build-wheel.html?突出显示=pyproject.toml#build-pyarmored-wheel

的内容 pyproject.toml

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

produces
Building wheels for collected packages: company-project
  Building wheel for company-project (pyproject.toml) ... done
  Created wheel for company-project: filename=company_project-1.0.0.0-py3-none-any.whl size=3906 sha256=dd639eb8fe24db685bb9b73576b7cdca656356211c935e031e08314b9d2ef562

当我更改 pyproject.toml

的内容时
[build-system]
requires = ["setuptools", "wheel", "pyarmor>7.2.0"]
build-backend = "pyarmor.build_meta"

生成的错误是


  Building wheel for company-project (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/employee/.pyenv/versions/3.6.7/bin/python /Users/employee/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/cd/ztpbtx9x13x634f270x96mbxjqz_sg/T/tmp2mqap73h
       cwd: /Users/employee/DEV/company-project
  Complete output (12 lines):
  Traceback (most recent call last):
    File "/Users/employee/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/Users/employee/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/employee/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
      metadata_directory)
    File "/private/var/folders/cd/ztpbtx9x13x634f270x96mbxjqz_sg/T/pip-build-env-euh9w736/overlay/lib/python3.6/site-packages/pyarmor/build_meta.py", line 100, in build_wheel
      config_settings = _fix_config(config_settings, obf_options)
    File "/private/var/folders/cd/ztpbtx9x13x634f270x96mbxjqz_sg/T/pip-build-env-euh9w736/overlay/lib/python3.6/site-packages/pyarmor/build_meta.py", line 72, in _fix_config
      from pip._internal.configuration import Configuration, ConfigurationError
  ModuleNotFoundError: No module named 'pip'
  ----------------------------------------
  ERROR: Failed building wheel for company-project
Failed to build company-project
ERROR: Failed to build one or more wheels



如果有帮助setup.py 如下所示

from os import path
import re
from setuptools import find_packages, setup


def open_file(filepath, mode='r'):
    here = path.abspath(path.dirname(__file__))
    full_path = path.join(here, filepath)
    return open(full_path, mode)


def find_version(package):
    with open_file('{}/__init__.py'.format(package)) as f:
        return re.findall(r"^__version__ = '([^']+)'\r?$", f.read(), re.M)[0]


def find_requires():
    with open_file('requirements.txt') as f:
        return [line.strip() for line in f]


NAME = 'company-project'
VERSION = find_version('company_project’)
PACKAGES = find_packages()
REQUIRES = find_requires()

setup(
    name=NAME,
    version=VERSION,
    packages=PACKAGES,
    include_package_data=True,
    zip_safe=False,
    install_requires=REQUIRES
)

链接指南中描述的方法在页面底部标记为不支持

Build pyarmored wheel is a helper function, there is no more support for this.

这在 github 问题(如 here)上得到进一步证实

Please check the documentation about wheel, there is no support for this feature.


对我有用的是首先简单地混淆代码并从混淆代码生成包

确保使用 package_data 和安装工具将 pytransform 库包含在包中。