Skip to content

Commit

Permalink
Depend: Make platform-specific dependencies conditional.
Browse files Browse the repository at this point in the history
The pefile and macholib libraries are only used on Windows and macOS,
respectively. All uses of these imports are conditional for the
platform, but setup.py contains a non-conditional requirement for them.
This causes the libraries to be installed even on platforms where they
are not needed.
  • Loading branch information
lkollar authored and bjones1 committed May 14, 2019
1 parent 01a75a6 commit 8365f1b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/4166.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Install platform-specific dependencies only on that platform.
1 change: 1 addition & 0 deletions news/4173.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Install platform-specific dependencies only on that platform.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# also tests/requirements-libraries.txt.

setuptools
pefile
macholib
pefile; sys_platform == 'win32'
macholib; sys_platform == 'darwin'
altgraph

dis3; python_version < '3.0'
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

REQUIREMENTS = [
'setuptools',
'pefile >= 2017.8.1',
'macholib >= 1.8',
'altgraph',
]

Expand All @@ -33,7 +31,11 @@

# For Windows install PyWin32 if not already installed.
if sys.platform.startswith('win'):
REQUIREMENTS.append('pywin32-ctypes >= 0.2.0')
REQUIREMENTS += ['pywin32-ctypes >= 0.2.0',
'pefile >= 2017.8.1']

if sys.platform == 'darwin':
REQUIREMENTS.append('macholib >= 1.8')


# Create long description from README.rst and doc/CHANGES.rst.
Expand Down

0 comments on commit 8365f1b

Please sign in to comment.