mbridon commented on issue #1855: URL: https://github.com/apache/buildstream/issues/1855#issuecomment-1680826614
Tried patching `versioneer.py` as follows: ``` commit 6d02c680c446a388cbd4228befeaaf5006df98ed (HEAD -> main) Author: Mathieu Bridon <[email protected]> Date: Tue Aug 8 09:28:01 2023 +0200 Try to fix #1855 diff --git a/versioneer.py b/versioneer.py index 1c97e02..8c6ad5d 100644 --- a/versioneer.py +++ b/versioneer.py @@ -340,9 +340,15 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() - with open(setup_cfg, "r") as f: - parser.readfp(f) + if sys.version_info.major == 3 and sys.version_info.minor >= 12: + parser = configparser.ConfigParser + parser.read_file(setup_cfg) + + else: + parser = configparser.SafeConfigParser + with open(setup_cfg, "r") as f: + parser.readfp(f) + VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name): ``` Building Buildstream in Fedora Rawhide (which does have Python 3.12) with that patch gave me the following : ``` + /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -sP' /builddir/build/BUILD/buildstream-2.0.1/versioneer.py:429: SyntaxWarning: invalid escape sequence '\s' LONG_VERSION_PY['git'] = ''' Traceback (most recent call last): File "/builddir/build/BUILD/buildstream-2.0.1/setup.py", line 73, in <module> version = versioneer.get_version() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/buildstream-2.0.1/versioneer.py", line 1489, in get_version return get_versions()["version"] ^^^^^^^^^^^^^^ File "/builddir/build/BUILD/buildstream-2.0.1/versioneer.py", line 1421, in get_versions cfg = get_config_from_root(root) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/buildstream-2.0.1/versioneer.py", line 345, in get_config_from_root parser.read_file(setup_cfg) TypeError: RawConfigParser.read_file() missing 1 required positional argument: 'f' ``` At that point, I'm at a complete loss... I mean, I explicitly wrote in the code : `parser.read_file(setup_cfg)`, so I did pass the positional argument `f`... :confused: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
