Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
0ba4f632
Commit
0ba4f632
authored
Jun 11, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles
parent
831813f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
7 deletions
+47
-7
sysconfig.py
sysconfig.py
+14
-7
tests/test_sysconfig.py
tests/test_sysconfig.py
+33
-0
No files found.
sysconfig.py
View file @
0ba4f632
...
...
@@ -285,18 +285,25 @@ def parse_makefile(fn, g=None):
while 1:
line = fp.readline()
if line is None:
# eof
if line is None: # eof
break
m = _variable_rx.match(line)
if m:
n, v = m.group(1, 2)
v = string.strip(v)
if "
$
" in v:
v = v.strip()
# `$$' is a literal `$' in make
tmpv = v.replace('$$', '')
if "
$
" in tmpv:
notdone[n] = v
else:
try: v = int(v)
except ValueError: pass
done[n] = v
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
# do variable interpolation here
while notdone:
...
...
@@ -324,7 +331,7 @@ def parse_makefile(fn, g=None):
else:
try: value = int(value)
except ValueError:
done[name] =
string.strip(value
)
done[name] =
value.strip(
)
else:
done[name] = value
del notdone[name]
...
...
tests/test_sysconfig.py
View file @
0ba4f632
"""Tests for distutils.sysconfig."""
import
os
import
test
import
unittest
from
distutils
import
sysconfig
...
...
@@ -9,6 +10,14 @@ from test.test_support import TESTFN
class
SysconfigTestCase
(
support
.
EnvironGuard
,
unittest
.
TestCase
):
def
setUp
(
self
):
super
(
SysconfigTestCase
,
self
).
setUp
()
self
.
makefile
=
None
def
tearDown
(
self
):
if
self
.
makefile
is
not
None
:
os
.
unlink
(
self
.
makefile
)
super
(
SysconfigTestCase
,
self
).
tearDown
()
def
test_get_config_h_filename
(
self
):
config_h
=
sysconfig
.
get_config_h_filename
()
...
...
@@ -56,8 +65,32 @@ class SysconfigTestCase(support.EnvironGuard,
sysconfig
.
customize_compiler
(
comp
)
self
.
assertEquals
(
comp
.
exes
[
'archiver'
],
'my_ar -arflags'
)
def
test_parse_makefile_base
(
self
):
self
.
makefile
=
test
.
test_support
.
TESTFN
fd
=
open
(
self
.
makefile
,
'w'
)
fd
.
write
(
r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'"
'
\
n
'
)
fd
.
write
(
'VAR=$OTHER
\
n
OTHER=foo'
)
fd
.
close
()
d
=
sysconfig
.
parse_makefile
(
self
.
makefile
)
self
.
assertEquals
(
d
,
{
'CONFIG_ARGS'
:
"'--arg1=optarg1' 'ENV=LIB'"
,
'OTHER'
:
'foo'
})
def
test_parse_makefile_literal_dollar
(
self
):
self
.
makefile
=
test
.
test_support
.
TESTFN
fd
=
open
(
self
.
makefile
,
'w'
)
fd
.
write
(
r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\
$$LIB
'"
'
\
n
'
)
fd
.
write
(
'VAR=$OTHER
\
n
OTHER=foo'
)
fd
.
close
()
d
=
sysconfig
.
parse_makefile
(
self
.
makefile
)
self
.
assertEquals
(
d
,
{
'CONFIG_ARGS'
:
r"'--arg1=optarg1' 'ENV=\
$LIB
'"
,
'OTHER'
:
'foo'
})
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
SysconfigTestCase
))
return
suite
if
__name__
==
'__main__'
:
test
.
test_support
.
run_unittest
(
test_suite
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment