openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

Support for Python 3.12 #475

Closed Vogtinator closed 1 year ago

Vogtinator commented 1 year ago

Fixes #474

M0ses commented 1 year ago

THX for your contribution

bluca commented 12 months ago

@Vogtinator @M0ses unfortunately this fix is not compatible with CentOS 7 (python 3.6):

[   88s] Traceback (most recent call last):
[   88s]   File "/usr/lib/obs/service/tar", line 30, in <module>
[   88s]     main()
[   88s]   File "/usr/lib/obs/service/tar", line 26, in main
[   88s]     TarSCM.run()
[   88s]   File "/usr/lib/obs/service/TarSCM/__init__.py", line 39, in run
[   88s]     task_list.process_list()
[   88s]   File "/usr/lib/obs/service/TarSCM/tasks.py", line 132, in process_list
[   88s]     self.process_single_task(task)
[   88s]   File "/usr/lib/obs/service/TarSCM/tasks.py", line 212, in process_single_task
[   88s]     self.scm_object = scm_object   = scm_class(args, self)
[   88s]   File "/usr/lib/obs/service/TarSCM/scm/base.py", line 82, in __init__
[   88s]     self._calc_repocachedir()
[   88s]   File "/usr/lib/obs/service/TarSCM/scm/base.py", line 234, in _calc_repocachedir
[   88s]     repocachedir = Config().get('tar_scm', 'CACHEDIRECTORY')
[   88s]   File "/usr/lib/obs/service/TarSCM/config.py", line 47, in __init__
[   88s]     self.configs.append(self._init_config(fname))
[   88s]   File "/usr/lib/obs/service/TarSCM/config.py", line 70, in _init_config
[   88s]     config.read_string(fake_header + open(fname, 'r').read(),
[   88s] AttributeError: RawConfigParser instance has no attribute 'read_string'
[   88s] service run failed for service 'tar'

https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk-20.11/CentOS_7/x86_64

Any idea if there's a way to make it work there too?

Vogtinator commented 12 months ago

read_string was introduced in Python 3.2. Does it use python 2 by chance?

bluca commented 12 months ago

Hard to tell from that log - both python2 and python3 are installed, that much can be seen, so maybe it is?

Vogtinator commented 12 months ago
-bash-4.2$ head /usr/lib/obs/service/tar
#!/usr/bin/python

urgh

Vogtinator commented 12 months ago

@adrianschroeter @dirkmueller @M0ses Is there a reason why on those platforms it uses python 2 still and we can't switch over?

That CI support for py2 was removed makes dealing with this a bit annoying.

The easiest option here is probably to keep the old code around in case if "read_string" not in dir(config)...

M0ses commented 12 months ago

Is there a reason why on those platforms it uses python 2 still and we can't switch over?

e.g. CentOS7 is missing python3-dateutil

M0ses commented 12 months ago

I merged a new commit - https://github.com/openSUSE/obs-service-tar_scm/pull/477