8000 Merge pull request #7584 from ssbarnea/hotfix/7572-percent-in-path · numpy/numpy@fffe1fb · GitHub
[go: up one dir, main page]

Skip to content

Commit fffe1fb

Browse files
committed
Merge pull request #7584 from ssbarnea/hotfix/7572-percent-in-path
BUG: fixes #7572, percent in path
2 parents 3c394f7 + d73e877 commit fffe1fb

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

numpy/distutils/npy_pkg_config.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import os
66

77
if sys.version_info[0] < 3:
8-
from ConfigParser import SafeConfigParser, NoOptionError
8+
from ConfigParser import RawConfigParser, NoOptionError
99
else:
10-
from configparser import ConfigParser, SafeConfigParser, NoOptionError
10+
from configparser import RawConfigParser, NoOptionError
1111

1212
__all__ = ['FormatError', 'PkgNotFound', 'LibraryInfo', 'VariableSet',
1313
'read_config', 'parse_flags']
@@ -259,11 +259,7 @@ def parse_config(filename, dirs=None):
259259
else:
260260
filenames = [filename]
261261

262-
if sys.version[:3] > '3.1':
263-
# SafeConfigParser is deprecated in py-3.2 and renamed to ConfigParser
264-
config = ConfigParser()
265-
else:
266-
config = SafeConfigParser()
262+
config = RawConfigParser()
267263

268264
n = config.read(filenames)
269265
if not len(n) >= 1:

numpy/distutils/system_info.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,15 @@
129129
from glob import glob
130130
from functools import reduce
131131
if sys.version_info[0] < 3:
132-
from ConfigParser import NoOptionError, ConfigParser
132+
from ConfigParser import NoOptionError
133+
from ConfigParser import RawConfigParser as ConfigParser
133134
else:
134-
from configparser import NoOptionError, ConfigParser
135+
from configparser import NoOptionError
136+
from configparser import RawConfigParser as ConfigParser
137+
# It seems that some people are importing ConfigParser from here so is
138+
# good to keep its class name. Use of RawConfigParser is needed in
139+
# order to be able to load path names with percent in them, like
140+
# `feature%2Fcool` which is common on git flow branch names.
135141

136142
from distutils.errors import DistutilsError
137143
from distutils.dist import Distribution

site.cfg.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# will also be checked for the file ~/.numpy-site.cfg .
99

1010
# The format of the file is that of the standard library's ConfigParser module.
11+
# No interpolation is allowed, RawConfigParser class being used to load it.
1112
#
1213
# http://docs.python.org/3/library/configparser.html
1314
#

0 commit comments

Comments
 (0)
0