Skip to content

Commit

Permalink
Deprecate --no-mangle-all
Browse files Browse the repository at this point in the history
The functionality of --no-mangle-all has been merged into --no-mangle.
If --no-mangle is specified with no DLLs, then we avoid mangling all
DLLs.
  • Loading branch information
adang1345 committed Aug 17, 2022
1 parent c9080fa commit cf92927
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ The path separator to use in the following options is `';'` on Windows and `':'`
- `-vv`: level 2, include warnings from `pefile`
- `--extract-dir`: directory to store extracted contents of wheel for debug use (default is a temp directory)
- `-w`,`--wheel-dir`: directory to write the repaired wheel (default is `wheelhouse` relative to current working directory)
- `--no-mangle`: name(s) of DLL(s) not to mangle, path-separator-delimited
- `--no-mangle-all`: don't mangle any DLL names
- `--no-mangle`: name(s) of DLL(s) not to mangle, path-separator-delimited; leave blank to avoid mangling all DLLs
- `-L`,`--lib-sdir`: subdirectory suffix in package to store vendored DLLs (default `.libs`)

## Limitations
Expand Down
20 changes: 16 additions & 4 deletions delvewheel/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import os
import sys
import warnings
from .wheel_repair import WheelRepair
from . import patch_dll

Expand Down Expand Up @@ -36,8 +37,8 @@ def main():
subparser.add_argument('-v', action='count', default=0, help='verbosity')
subparser.add_argument('--extract-dir', help=argparse.SUPPRESS)
parser_repair.add_argument('-w', '--wheel-dir', dest='target', default='wheelhouse', help='directory to write repaired wheel')
parser_repair.add_argument('--no-mangle', default='', metavar='DLLS', help=f'DLL names(s) not to mangle, {os.pathsep!r}-delimited')
parser_repair.add_argument('--no-mangle-all', action='store_true', help="don't mangle any DLL names")
parser_repair.add_argument('--no-mangle', nargs='?', const='', metavar='DLLS', help=f'DLL names(s) not to mangle, {os.pathsep!r}-delimited; leave blank to avoid mangling all DLLs')
parser_repair.add_argument('--no-mangle-all', action='store_true', help=argparse.SUPPRESS) # deprecated
parser_repair.add_argument('-L', '--lib-sdir', default='.libs', type=subdir_suffix, help='directory suffix in package to store vendored DLLs (default .libs)')
parser_needed.add_argument('file', help='path to a DLL or PYD file')
parser_needed.add_argument('-v', action='count', default=0, help='verbosity')
Expand All @@ -63,8 +64,19 @@ def main():
if args.command == 'show':
wr.show()
else: # args.command == 'repair'
no_mangles = set(dll_name.lower() for dll_name in args.no_mangle.split(os.pathsep) if dll_name)
wr.repair(args.target, no_mangles, args.no_mangle_all, args.lib_sdir)
if args.no_mangle_all: # remove this block when --no-mangle-all is deleted
warnings.warn('--no-mangle-all is deprecated and will be removed in version 1.0, as its functionality has been merged into --no-mangle. Replace it with --no-mangle.')
args.no_mangle = ''
if args.no_mangle is None:
no_mangles = set()
no_mangle_all = False
elif args.no_mangle == '':
no_mangles = set()
no_mangle_all = True
else:
no_mangles = set(dll_name.lower() for dll_name in args.no_mangle.split(os.pathsep) if dll_name)
no_mangle_all = False
wr.repair(args.target, no_mangles, no_mangle_all, args.lib_sdir)
else: # args.command == 'needed'
for dll_name in patch_dll.get_direct_needed(args.file, True, args.v):
print(dll_name)
Expand Down

0 comments on commit cf92927

Please sign in to comment.