Skip to content

Commit 817eeee

Browse files
committed
Refine building wheel
1 parent 75b0f1e commit 817eeee

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

docs/build-wheel.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ Build a pyarmored wheel by same commands::
4545
cd mypkg/
4646
pip wheel .
4747

48+
Or build a pyarmored wheel with :ref:`Super Mode` by setting extra obfuscation
49+
options in environment variable ``PIP_PYARMOR_OPTIONS``::
50+
51+
cd mypkg/
52+
53+
# In Windows
54+
set PIP_PYARMOR_OPTIONS=--advanced 2
55+
pip wheel .
56+
57+
# In Linux or MacOs
58+
PIP_PYARMOR_OPTIONS="--advanced 2" pip wheel .
59+
4860
``pyarmor.build_meta`` also supports pip configuration ``pyarmor.advanced`` to
4961
build a pyarmored wheel with :ref:`Super Mode`.
5062

@@ -59,7 +71,7 @@ Then::
5971

6072
Removing this configuration by this way::
6173

62-
pip config unset pyarmor.advanced
74+
pip config unset pyarmor.advanced
6375

6476
How does it work
6577
----------------

src/build_meta.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ def _wheel_append_runtime_files(build_path, namever, pkgname):
6969

7070

7171
def _fix_config(config_settings, obf_options):
72-
from pip._internal.configuration import Configuration
72+
from pip._internal.configuration import Configuration, ConfigurationError
7373
config = Configuration(False)
7474
config.load()
75-
for k, v in config.items():
75+
for k, v in reversed(config.items()):
7676
if k in ('pyarmor.advanced', ':env:.pyarmor-advanced'):
77+
if v not in ('2', '3', '4', '5'):
78+
raise ConfigurationError('Invalid pyarmor.advanced')
7779
obf_options.extend(['--advanced', v])
7880
break
7981

0 commit comments

Comments
 (0)