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

Doesn't build with Python 3.12 #13

Open
AdamWill opened this issue Aug 26, 2023 · 4 comments
Open

Doesn't build with Python 3.12 #13

AdamWill opened this issue Aug 26, 2023 · 4 comments

Comments

@AdamWill
Copy link

pathtools uses imp to get its internal version into setup.py (which seems like a kinda crazy approach to me, but hey). imp was retired in Python 3.12. There's a formula to replace the bit of it pathtools uses:

import importlib.util
import importlib.machinery

def load_source(modname, filename):
    loader = importlib.machinery.SourceFileLoader(modname, filename)
    spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
    module = importlib.util.module_from_spec(spec)
    # The module is always executed and not cached in sys.modules.
    # Uncomment the following line to cache the module.
    # sys.modules[module.__name__] = module
    loader.exec_module(module)
    return module

which seems like a lot of boilerplate just to get a version number, but hey, you can do that if you like. If it was my project I'd just use some different approach to the version number issue (my own projects have a script for doing version bumps which does this, but I've seen lots of different approaches).

For downstream (we ran into this in Fedora) I've just used a dumb non-upstreamable patch to replace the use of imp to set the version in setup.py with a marker string which we replace with the correct version in the package spec file (since we know what the version is, there).

@JoanaMarieL
Copy link

Hi @AdamWill ,

We received this concern and we are looking into it. We'll get back to you when we have an update.

@alejandro-angulo
Copy link

alejandro-angulo commented Dec 21, 2023

Looks like someone has submitted PR #14 to fix this

@ecederstrand
Copy link

Ping @JoanaMarieL ?

BillyONeal added a commit to BillyONeal/vcpkg that referenced this issue Jun 3, 2024
…bot tagged dependencies.

Pathtools does not work with Python 3.12 ( gorakhargosh/pathtools#13 ) and qtinterfaceframework says: - Use ``pathlib`` from the standard library, instead of pathtools (`microsoft#556 <https://github.com/gorakhargosh/watchdog/pull/556>`_)
BillyONeal added a commit to BillyONeal/vcpkg that referenced this issue Jun 3, 2024
…bot tagged dependencies.

Pathtools does not work with Python 3.12 ( gorakhargosh/pathtools#13 ) and qtinterfaceframework says: - Use ``pathlib`` from the standard library, instead of pathtools (`microsoft#556 <https://github.com/gorakhargosh/watchdog/pull/556>`_)
@Frank-Steiner
Copy link

Will that ever be fixed...?

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

No branches or pull requests

5 participants