Opened 2 years ago

Last modified 2 years ago

#64457 new defect

build.py script in source code overrides 'build' tool

Reported by: blazewicz (Krzysztof Błażewicz) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc: jmroot (Joshua Root)
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I found this issue while investigating #64425.

When source code of Python project contains a script called build.py or a submodule called build it will override global installation of the build tool. This is when MacPorts invokes /path/to/python -m build ... local script/module will be invoked instead of intended tool. In such cases pep517 build will always fail.

Issue begun after [e94c8a1f8531ced6e1d765849193e36a590425c9/macports-ports] and so far I found that it affects py-pendulum port.

Change History (3)

comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:2 Changed 2 years ago by jmroot (Joshua Root)

Yes, python will search for modules in the current directory first. So when running python -m foo, any file foo.py in the current dir will be executed instead of a module foo installed in site-packages.

https://docs.python.org/3/library/sys.html#sys.path

comment:3 Changed 2 years ago by blazewicz (Krzysztof Błażewicz)

Ok, ticket:64425#comment:10 explains it all.

[2a9b98736b82d1f751659a0b652d0ec350d26201/macports-ports] is possible workaround for affected ports

Note: See TracTickets for help on using tickets.