Modify ↓
Ticket #461 (new task)
exclude all non-platform modules
| Reported by: | htgoebel | Owned by: | matysek |
|---|---|---|---|
| Priority: | low | Milestone: | PyInstaller 2.2 |
| Component: | Hooks | Version: | develop |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Both remove modules not used for the target platform. hook-os removes some more, while hook-iu differs between more platform.
Attachments
Change History
comment:1 Changed 18 months ago by htgoebel
- Status changed from new to assigned
- Summary changed from unify hook-iu and hook-os to exclude all non-platform modules
comment:2 Changed 18 months ago by htgoebel
I would like to add code like this to mf.py:
PLATFORM_REMOVES = set([
'ce',
'dos', 'dospath',
'mac', 'macpath', 'macurl2path',
'nt', 'ntpath', 'nturl2path',
'os2', 'os2emxpath',
'posix', 'posixpath',
'riscos', 'riscosenviron','riscospath',
'win32api'])
names = sys.builtin_module_names
if 'posix' in names:
PLATFORM_REMOVES -= set('posix', 'posixpath')
elif 'nt' in names:
PLATFORM_REMOVES -= set(['nt', 'ntpath', 'nturl2path', 'win32api'])
elif 'os2' in names:
PLATFORM_REMOVES -= set(['os2', 'os2emxpath'])
elif 'dos' in names:
PLATFORM_REMOVES -= set(['dos', 'dospath'])
elif 'mac' in names:
PLATFORM_REMOVES -= set(['mac', 'macpath', 'macurl2path'])
pprint(PLATFORM_REMOVES)
What do you think?
comment:3 Changed 18 months ago by htgoebel
On the other had: Is this needed at all? This should only suppress warnings, since modules for a different platform are not available anyway.
comment:4 Changed 18 months ago by htgoebel
This would be really useful: As soon as os is imported, this will add posix, posixpath, os2emxpath, _emx_link, ntpath, nt and probably some others.
Note: See
TracTickets for help on using
tickets.

Rethinking the topic, this should exclude all non-platform modules, not only in hook-iu and hook-os.