Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py: don't import rd6006 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

cstrahan
Copy link

@cstrahan cstrahan commented Aug 6, 2022

This makes it possible to install under poetry (and similar).

Before this change, you'd get an error like so:

PackageInfoError

Unable to determine package info for path: /home/cstrahan/src/cal-riden-psu/../rd6006

Fallback egg_info generation failed.

Command ['/tmp/tmp30wom7ih/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1, and output:
Traceback (most recent call last):
  File "/home/cstrahan/src/rd6006/setup.py", line 13, in <module>
    import rd6006
  File "/home/cstrahan/src/rd6006/rd6006/__init__.py", line 1, in <module>
    from .rd6006 import *
  File "/home/cstrahan/src/rd6006/rd6006/rd6006.py", line 1, in <module>
    import minimalmodbus
ModuleNotFoundError: No module named 'minimalmodbus'

at ~/.asdf/installs/poetry/1.1.14/lib/poetry/inspection/info.py:500 in _pep517_metadata
    496│                 try:
    497│                     venv.run_python("setup.py", "egg_info")
    498│                     return cls.from_metadata(path)
    499│                 except EnvCommandError as fbe:
  → 500│                     raise PackageInfoError(
    501│                         path, "Fallback egg_info generation failed.", fbe
    502│                     )
    503│                 finally:
    504│                     os.chdir(cwd.as_posix())

This commit resolves that.

See https://packaging.python.org/en/latest/guides/single-sourcing-package-version/

This makes it possible to install under poetry (and similar).

Before this change, you'd get an error like so:

    PackageInfoError

    Unable to determine package info for path: /home/cstrahan/src/cal-riden-psu/../rd6006

    Fallback egg_info generation failed.

    Command ['/tmp/tmp30wom7ih/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1, and output:
    Traceback (most recent call last):
      File "/home/cstrahan/src/rd6006/setup.py", line 13, in <module>
        import rd6006
      File "/home/cstrahan/src/rd6006/rd6006/__init__.py", line 1, in <module>
        from .rd6006 import *
      File "/home/cstrahan/src/rd6006/rd6006/rd6006.py", line 1, in <module>
        import minimalmodbus
    ModuleNotFoundError: No module named 'minimalmodbus'

    at ~/.asdf/installs/poetry/1.1.14/lib/poetry/inspection/info.py:500 in _pep517_metadata
        496│                 try:
        497│                     venv.run_python("setup.py", "egg_info")
        498│                     return cls.from_metadata(path)
        499│                 except EnvCommandError as fbe:
      → 500│                     raise PackageInfoError(
        501│                         path, "Fallback egg_info generation failed.", fbe
        502│                     )
        503│                 finally:
        504│                     os.chdir(cwd.as_posix())

This commit resolves that.

See https://packaging.python.org/en/latest/guides/single-sourcing-package-version/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant