Skip to content

Commit 1e1d12f

Browse files
committed
fix ParallelSSH#82 - Python 3.12 support
1 parent a62aaf2 commit 1e1d12f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

versioneer.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* https://github.com/warner/python-versioneer
1111
* Brian Warner
1212
* License: Public Domain
13-
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy
13+
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, 3.12, and pypy
1414
* [![Latest Version]
1515
(https://pypip.in/version/versioneer/badge.svg?style=flat)
1616
](https://pypi.python.org/pypi/versioneer/)
@@ -278,9 +278,9 @@
278278

279279
from __future__ import print_function
280280
try:
281-
import configparser
281+
from configparser import ConfigParser
282282
except ImportError:
283-
import ConfigParser as configparser
283+
from ConfigParser import SafeConfigParser as ConfigParser
284284
import errno
285285
import json
286286
import os
@@ -339,9 +339,12 @@ def get_config_from_root(root):
339339
# configparser.NoOptionError (if it lacks "VCS="). See the docstring at
340340
# the top of versioneer.py for instructions on writing your setup.cfg .
341341
setup_cfg = os.path.join(root, "setup.cfg")
342-
parser = configparser.SafeConfigParser()
342+
parser = ConfigParser()
343343
with open(setup_cfg, "r") as f:
344-
parser.readfp(f)
344+
if hasattr(parser, "read_file"):
345+
parser.read_file(f)
346+
else:
347+
parser.readfp(f)
345348
VCS = parser.get("versioneer", "VCS") # mandatory
346349

347350
def get(parser, name):

0 commit comments

Comments
 (0)