8000 BLD: Add a best-effort build.log parser that looks for warnings by mattip · Pull Request #14470 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD: Add a best-effort build.log parser that looks for warnings #14470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions numpy/distutils/numpy_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def __init__(self, attrs = None):
self.installed_libraries = []
# A dict of pkg_config files to generate/install
self.installed_pkg_config = {}
self.define_macros = attrs.pop('define_macros', None)
Distribution.__init__(self, attrs)

def has_scons_scripts(self):
Expand Down
37 changes: 29 additions & 8 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,12 @@ def build_project(args):
log_filename = os.path.join(ROOT_DIR, 'build.log')

if args.show_build_log:
# XXX how can we get stdout, stderr simultaneously output to the log
# file and to the screen? Any simple solution using communicate and
# readline() is succeptable to deadlock, maybe asyncio.subprocess ...
ret = subprocess.call(cmd, env=env, cwd=ROOT_DIR)
else:
log_filename = os.path.join(ROOT_DIR, 'build.log')
print("Building, see build.log...")
print("Building, see {}...".format(log_filename))
with open(log_filename, 'w') as log:
p = subprocess.Popen(cmd, env=env, stdout=log, stderr=log,
cwd=ROOT_DIR)
Expand Down Expand Up @@ -416,13 +418,32 @@ def build_project(args):

if ret == 0:
print("Build OK")
else:
if not args.show_build_log:
with open(log_filename, 'r') as f:
print(f.read())
print("Build failed!")
elif not args.show_build_log:
with open(log_filename, 'r') as f:
print(f.read())
print("Build failed!")
sys.exit(1)

if sys.platform == 'linux':
# Parse the log file for warnings
warnings = []
with open(log_filename, 'r') as log:
for line in log:
skip = False
for ignore in ['_configtest', 'ld returned 1', '-c',
'manifest_maker: standard file ', 'test_warnings.py',
'no previously-included files matching',
]:
if ignore in line:
skip = True
break
if skip is True:
continue
if 'warning' in line:
warnings.append(line)
if len(warnings) > 0:
print('Warnings found in {}'.format(log_filename))
print('\n'.join(warnings))
sys.exit(1)
return site_dir, site_dir_noarch


Expand Down
0