Skip to content

Commit

Permalink
Only require attrdict3 on Windows
Browse files Browse the repository at this point in the history
It's only used on Windows, so only require it there.
  • Loading branch information
swt2c committed Aug 9, 2022
1 parent e220dab commit 2e9169e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions buildtools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

import distutils.sysconfig

from attrdict import AttrDict

runSilently = False

#----------------------------------------------------------------------
Expand Down Expand Up @@ -992,6 +990,8 @@ def getMSVCInfo(PYTHON, arch, set_env=False):
if MSVCinfo is not None:
return MSVCinfo

from attrdict import AttrDict

# Note that it starts with a monkey-patch in setuptools.msvc to
# workaround this issue: pypa/setuptools#1902
cmd = \
Expand Down
2 changes: 1 addition & 1 deletion requirements/devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Jinja2==2.10
markupsafe==1.1.1
doc2dash==2.3.0
beautifulsoup4
attrdict3
attrdict3 ; sys_platform == 'win32'

4 comments on commit 2e9169e

@HelioGuilherme66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swt2c I think this change should be reverted. I am with Fedora 36, python 3.10.6 with virtualenv, and attrdict3 is needed to install.
output:

(venv) [helio@localhost venv]$ python -m pip install -U --force wxPython
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-osdlm4c4/wxpython_2dbe2f2f40c745f889c156d8d66fa02c/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-osdlm4c4/wxpython_2dbe2f2f40c745f889c156d8d66fa02c/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) [helio@localhost venv]$ python -m pip install attrdict
Collecting attrdict
  Downloading attrdict-2.0.1-py2.py3-none-any.whl (9.9 kB)
Requirement already satisfied: six in ./lib/python3.10/site-packages (from attrdict) (1.16.0)
Installing collected packages: attrdict
Successfully installed attrdict-2.0.1
(venv) [helio@localhost venv]$ python -m pip install -U --force wxPython
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-1_4qubsw/wxpython_83761f7f0b5948ca88b9336992831ac1/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-1_4qubsw/wxpython_83761f7f0b5948ca88b9336992831ac1/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
        File "/home2/helio/venv/lib64/python3.10/site-packages/attrdict/__init__.py", line 5, in <module>
          from attrdict.mapping import AttrMap
        File "/home2/helio/venv/lib64/python3.10/site-packages/attrdict/mapping.py", line 4, in <module>
          from collections import Mapping
      ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) [helio@localhost venv]$ python -m pip install attrdict3
Collecting attrdict3
  Downloading attrdict3-2.0.2-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: six in ./lib/python3.10/site-packages (from attrdict3) (1.16.0)
Installing collected packages: attrdict3
Successfully installed attrdict3-2.0.2
(venv) [helio@localhost venv]$ python -m pip install -U --force wxPython
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... done
Collecting pillow
  Using cached Pillow-9.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.2 MB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting numpy
  Using cached numpy-1.23.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB)
Building wheels for collected packages: wxPython
  Building wheel for wxPython (setup.py) ...

@swt2c
Copy link
Collaborator Author

@swt2c swt2c commented on 2e9169e Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HelioGuilherme66, actually this change would fix the error you saw with wxPython 4.2.0 on Linux. In wxPython 4.2.0, build.py imports attrdict on all platforms, but doesn't actually use it except on Windows. This change makes it so that it is only imported on Windows.

@HelioGuilherme66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swt2c OK, I understand the fix, but wasn't this already merged and in PyPi archive tar.gz?

@swt2c
Copy link
Collaborator Author

@swt2c swt2c commented on 2e9169e Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Please sign in to comment.