Opened 3 years ago

Last modified 23 months ago

#65109 assigned enhancement

py-build,py-bootstrap-modules: breaks use of trace-mode

Reported by: reneeotten (Renee Otten) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc: danchr (Dan Villiom Podlaski Christiansen)
Port: py-build py-bootstrap-modules

Description

For Python ports that use python.pep517 yes one cannot use trace-mode at this moment. Builds will all fail when either colorama or importlib-metadata are installed.

  1. AttributeError: module 'colorama' has no attribute 'init'

The colorama package is only required on Windows, but do to the way it checks for the presence of the package it causes a failure in trace-mode. This is easily fixed by just patching out the use of colorama in build-0.7.0/src/build/__main__.py.

  1. AttributeError: module 'importlib_metadata' has no attribute 'MetadataPathFinder'

This is likely due to how setuptools checks whether the importlib_metadata package is available... an "easy" but not really correct way would be to just add the pyXY-importlib-metadata as a build dependency or investigate further on how this can be avoided in py-build.

I am happy to try and fix building using pep517 in trace-mode, but first wanted to get some opinions before spending time on it.

Change History (3)

comment:1 Changed 3 years ago by jmroot (Joshua Root)

I'm really not interested in trying to work around bugs in trace mode, especially when it's affecting something as ubiquitous as module importing, which could easily become an endless rabbit hole of problems. If you want to fix this, the way to do it would be to figure out what mechanism trace mode is not wrapping properly, and fix that in base.

comment:2 in reply to:  1 Changed 3 years ago by reneeotten (Renee Otten)

Replying to jmroot:

I'm really not interested in trying to work around bugs in trace mode, especially when it's affecting something as ubiquitous as module importing, which could easily become an endless rabbit hole of problems. If you want to fix this, the way to do it would be to figure out what mechanism trace mode is not wrapping properly, and fix that in base.

Fair enough and I agree that what I am suggesting isn't the best way... but fixing trace-mode would be useful and what I suggested should solve this particular issue when building with pep517. It is certainly faster than me trying to figure out how trace-mode is implemented in base, attempt to spot the problem and come up with a solution - time is limited and that's something I am not really interested in doing. So I guess we can just close this ticket, or we wait and hope that someone will come along and try to work on the trace-mode code in base.

comment:3 Changed 23 months ago by danchr (Dan Villiom Podlaski Christiansen)

In e2b5f57f25f0f2934ceb78b4558411ca200c9d87/macports-ports (master):

py-build: update to 0.9.0

The upgrade addresses the issues with Colorama & trace mode. The
issues with importlib_metadata seem to persist, but only for certain
older versions of Python as far as I can tell. To work around this, we
simply add it as (sort of) redundant dependency.

See #65109

Note: See TracTickets for help on using tickets.