Skip to content

Commit 69e78cf

Browse files
committed
Merge branch 'hotfix/v1.8.4'
2 parents b0a6243 + 2d9e974 commit 69e78cf

File tree

8 files changed

+44
-8
lines changed

8 files changed

+44
-8
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ script:
173173
# Modify sitecustomize.py file for coverage. Allows to cover files run in a subprocess.
174174
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then touch "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/lib/python${TRAVIS_PYTHON_VERSION}/sitecustomize.py"; fi
175175
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $TRAVIS_PYTHON_VERSION == 2 ]]; then touch "/usr/local/lib/python2.7/site-packages/sitecustomize.py"; fi
176-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $TRAVIS_PYTHON_VERSION == 3 ]]; then touch "/usr/local/lib/python3.5/site-packages/sitecustomize.py"; fi
176+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $TRAVIS_PYTHON_VERSION == 3 ]]; then touch "/usr/local/lib/python3.6/site-packages/sitecustomize.py"; fi
177177

178178
- if [[ "$TRAVIS_OS_NAME" == "linux" ]];
179179
then printf "import coverage\ncoverage.process_startup()\n" > "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/lib/python${TRAVIS_PYTHON_VERSION}/sitecustomize.py"; fi
180180
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $TRAVIS_PYTHON_VERSION == 2 ]];
181181
then printf "import coverage\ncoverage.process_startup()\n" > "/usr/local/lib/python2.7/site-packages/sitecustomize.py"; fi
182182
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ $TRAVIS_PYTHON_VERSION == 3 ]];
183-
then printf "import coverage\ncoverage.process_startup()\n" > "/usr/local/lib/python3.5/site-packages/sitecustomize.py"; fi
183+
then printf "import coverage\ncoverage.process_startup()\n" > "/usr/local/lib/python3.6/site-packages/sitecustomize.py"; fi
184184

185185
# Install pygccxml
186186
- python setup.py install

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
Changes
22
=======
33

4+
Version 1.8.4
5+
-------------
6+
7+
1. Include paths read from configuration files on windows are now normed
8+
and passed between quotation marks. This makes ```pygccxml``` more robust
9+
when used on Windows (with paths containing whitespaces).
10+
11+
2. Closed cache file handle, which would not be closed in case of an exception
12+
(warning thrown by Python 2.7.13)
13+
14+
3. Always call wait() on subprocesses before closing stdout/stderr streams.
15+
Detected by Python 3.6. Fixes the following warning:
16+
ResourceWarning: subprocess xxxxx is still running
17+
18+
4. Fix deprecation warnings thrown by ```ConfigParser``` when using pygccxml
19+
with python 2.7.13. Fix the usage of ```pygccxml``` with python 3.6.
20+
21+
5. Updated travis setup to python 3.6 for OS X.
22+
423
Version 1.8.3
524
-------------
625

pygccxml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
# TODO:
4141
# 1. Add "explicit" property for constructors
4242

43-
__version__ = '1.8.3'
43+
__version__ = '1.8.4'

pygccxml/parser/config.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
import platform
1414
import subprocess
1515
import warnings
16+
# In py3, ConfigParser was renamed to the more-standard configparser.
17+
# But there's a py3 backport that installs "configparser" in py2, and I don't
18+
# want it because it has annoying deprecation warnings. So try the real py2
19+
# import first
20+
# Inspired by https://bitbucket.org/ned/coveragepy/commits/f8e9d62f1412
1621
try:
17-
from configparser import ConfigParser
18-
except ImportError:
1922
from ConfigParser import SafeConfigParser as ConfigParser
23+
except ImportError:
24+
from configparser import ConfigParser
2025
from .. import utils
2126

2227

@@ -397,7 +402,7 @@ def load_xml_generator_configuration(configuration, **defaults):
397402
for p in value.split(';'):
398403
p = p.strip()
399404
if p:
400-
cfg.include_paths.append(p)
405+
cfg.include_paths.append(os.path.normpath(p))
401406
elif name == 'compiler':
402407
cfg.compiler = value
403408
elif name == 'xml_generator':
@@ -443,6 +448,7 @@ def create_compiler_path(xml_generator, compiler_path):
443448
stdout=subprocess.PIPE,
444449
stderr=subprocess.PIPE)
445450
compiler_path = p.stdout.read().decode("utf-8").rstrip()
451+
p.wait()
446452
p.stdout.close()
447453
p.stderr.close()
448454
# No mscv found; look for mingw
@@ -452,6 +458,7 @@ def create_compiler_path(xml_generator, compiler_path):
452458
stdout=subprocess.PIPE,
453459
stderr=subprocess.PIPE)
454460
compiler_path = p.stdout.read().decode("utf-8").rstrip()
461+
p.wait()
455462
p.stdout.close()
456463
p.stderr.close()
457464
else:
@@ -462,6 +469,7 @@ def create_compiler_path(xml_generator, compiler_path):
462469
stdout=subprocess.PIPE,
463470
stderr=subprocess.PIPE)
464471
compiler_path = p.stdout.read().decode("utf-8").rstrip()
472+
p.wait()
465473
p.stdout.close()
466474
p.stderr.close()
467475
# No clang found; use gcc
@@ -471,6 +479,7 @@ def create_compiler_path(xml_generator, compiler_path):
471479
stdout=subprocess.PIPE,
472480
stderr=subprocess.PIPE)
473481
compiler_path = p.stdout.read().decode("utf-8").rstrip()
482+
p.wait()
474483
p.stdout.close()
475484
p.stderr.close()
476485

pygccxml/parser/declarations_cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,16 @@ def __load(file_name):
220220
% (file_name, len(list(cache.keys()))))
221221
except Exception as error:
222222
file_cache_t.logger.exception(
223-
"Error occured while reading cache file: %s",
223+
"Error occurred while reading cache file: %s",
224224
error)
225225
cache_file_obj.close()
226226
file_cache_t.logger.info(
227227
"Invalid cache file: [%s] Regenerating." %
228228
file_name)
229229
open(file_name, 'w+b').close() # Create empty file
230230
cache = {} # Empty cache
231+
finally:
232+
cache_file_obj.close()
231233
return cache
232234

233235
def flush(self):

pygccxml/parser/source_reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def __create_command_line(self, source_file, xml_file):
122122
stdout=subprocess.PIPE,
123123
stderr=subprocess.PIPE)
124124
help = p.stdout.read().decode("utf-8")
125+
p.wait()
125126
p.stdout.close()
126127
p.stderr.close()
127128
if "CastXML wrapper" in help:
@@ -155,7 +156,7 @@ def __create_command_line_castxml(self, source_file, xmlfile):
155156

156157
# Add additional includes directories
157158
dirs = self.__search_directories
158-
cmd.append(''.join([' -I%s' % search_dir for search_dir in dirs]))
159+
cmd.append(''.join([' -I"%s"' % search_dir for search_dir in dirs]))
159160

160161
# Clang option: -c Only run preprocess, compile, and assemble steps
161162
cmd.append("-c")
@@ -349,6 +350,7 @@ def create_xml_file(self, source_file, destination=None):
349350
utils.remove_file_no_raise(xml_file, self.__config)
350351
raise
351352
finally:
353+
process.wait()
352354
process.stdout.close()
353355
return xml_file
354356

pygccxml/utils/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,22 @@ def find_xml_generator(name=None):
5353
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
5454
stderr=subprocess.PIPE)
5555
path = p.stdout.read().decode("utf-8")
56+
p.wait()
5657
p.stdout.close()
5758
p.stderr.close()
5859
if path == "":
5960
name = "gccxml"
6061
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
6162
stderr=subprocess.PIPE)
6263
path = p.stdout.read().decode("utf-8")
64+
p.wait()
6365
p.stdout.close()
6466
p.stderr.close()
6567
else:
6668
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
6769
stderr=subprocess.PIPE)
6870
path = p.stdout.read().decode("utf-8")
71+
p.wait()
6972
p.stdout.close()
7073
p.stderr.close()
7174
if path == "":

unittests/file_cache_tester.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def test_reopen_cache():
101101
stdout=subprocess.PIPE,
102102
env=env)
103103
print(p.stdout.read())
104+
p.wait()
104105
p.stdout.close()
105106

106107

0 commit comments

Comments
 (0)