Opened 2 months ago

Last modified 2 months ago

#72354 new defect

gpsd, gmtl fail to build after scons update to python 3.13: ModuleNotFoundError: No module named 'distutils'

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: Cc: michaelld (Michael Dickens), fhgwright (Fred Wright)
Port: gpsd, gmtl

Description

--->  Configuring gpsd
--->  Building gpsd
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_gpsd/gpsd/work/gpsd-3.25" && /opt/local/bin/scons -j6 prefix=/opt/local target_python=/opt/local/bin/python3.12 python_shebang=/opt/local/bin/python3.12 qt=no usb=no strip=no dbus_export=no xgps=no 
scons: Reading SConscript files ...
ModuleNotFoundError: No module named 'distutils':
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_gpsd/gpsd/work/gpsd-3.25/SConstruct", line 69:
    SConscript('SConscript',
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/SCons/Script/SConscript.py", line 684:
    return method(*args, **kw)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/SCons/Script/SConscript.py", line 620:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/SCons/Script/SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_gpsd/gpsd/work/gpsd-3.25/gpsd-3.25/SConscript", line 25:
    from distutils import sysconfig
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_gpsd/gpsd/work/gpsd-3.25" && /opt/local/bin/scons -j6 prefix=/opt/local target_python=/opt/local/bin/python3.12 python_shebang=/opt/local/bin/python3.12 qt=no usb=no strip=no dbus_export=no xgps=no 
Exit code: 2
Error: Failed to build gpsd: command execution failed

Change History (5)

comment:1 Changed 2 months ago by fhgwright (Fred Wright)

This is because scons was blindly switched to Python 3.13 without considering the consequences.

gpsd may not be the only port that was broken by that change.

The simplest short-term workaround is probably to locally revert [4017d381d098285dca39a776eacfaf483cf7dfd6/macports-ports].

Last edited 2 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

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

It is true that I switched scons to python313 without verifying whether this would break ports.

However, we can't just keep scons on an old version of python forever. We stayed on python27 for far too long, for example. See #59303. It was reasonable to stick with python27 for awhile because of syntax differences between python 2 and 3.

I'm not surprised that this change has broken ports. Previous python updates of the scons port have broken other ports.

It's unfortunately part of the design of scons that projects using scons must keep up with changes in the python language. It's one of the reasons why I don't like scons.

My suggestion is to update gpsd to a version that is compatible with python 3.13. If none exists yet, file a bug with its developers. Same for any other ports that were broken this scons change.

comment:3 Changed 2 months ago by jmroot (Joshua Root)

If changing the version of python used by scons broke gpsd, I suspect that gpsd's python* variants never quite worked properly, since the setuptools dependency (which is what provides distutils) is added based on which python version gpsd is using.

comment:4 Changed 2 months ago by barracuda156

gmtl also fails now:

--->  Applying SConstruct-scons.patch
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1" && /usr/bin/patch -t -N -p0 < '/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/math/gmtl/files/SConstruct-scons.patch'
patching file SConstruct
Hunk #1 succeeded at 626 (offset -1 lines).
patching file Test/TestSuite/SConscript
patching file python/SConscript
patching file tools/build/AutoDist.py
--->  Patching gmtl-config: s|@PYTHON_BIN@|/opt/local/bin/python2.7|g
--->  Configuring gmtl
--->  Building gmtl
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1" && /opt/local/bin/scons -j6 prefix=/opt/local BoostPythonDir=/var/empty CppUnitDir=/var/empty 
scons: Reading SConscript files ...
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:40: SyntaxWarning: invalid escape sequence '\d'
  major = re.compile('.*(#define *GMTL_VERSION_MAJOR *(\d+)).*', re.DOTALL).sub(r'\2', contents)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:41: SyntaxWarning: invalid escape sequence '\d'
  minor = re.compile('.*(#define *GMTL_VERSION_MINOR *(\d+)).*', re.DOTALL).sub(r'\2', contents)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:42: SyntaxWarning: invalid escape sequence '\d'
  patch = re.compile('.*(#define *GMTL_VERSION_PATCH *(\d+)).*', re.DOTALL).sub(r'\2', contents)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:123: SyntaxWarning: invalid escape sequence '\/'
  exp = re.compile('^(.*)\/Python\.framework.*$')
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:297: SyntaxWarning: invalid escape sequence '\d'
  exp = re.compile('^(\d+\.\d+(\.\d+)?)\D*$')
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct:330: SyntaxWarning: invalid escape sequence '\s'
  ver_num = int(re.search("define\s+?BOOST_VERSION\s+?(\d*)",
ModuleNotFoundError: No module named 'distutils':
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1/SConstruct", line 9:
    import distutils.sysconfig
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_gmtl/gmtl/work/gmtl-0.6.1" && /opt/local/bin/scons -j6 prefix=/opt/local BoostPythonDir=/var/empty CppUnitDir=/var/empty 
Exit code: 2

comment:5 Changed 2 months ago by barracuda156

Port: gmtl added
Summary: gpsd fails to build now: ModuleNotFoundError: No module named 'distutils'gpsd, gmtl fail to build after scons update to python 3.13: ModuleNotFoundError: No module named 'distutils'
Note: See TracTickets for help on using tickets.