Skip to content

MAINT: Append *FLAGS instead of overriding - #11525

Merged
rgommers merged 9 commits into
numpy:masterfrom
isuruf:ldflags
Jul 14, 2018
Merged

rgommers merged 9 commits into
numpy:masterfrom
isuruf:ldflags

Conversation

@isuruf

@isuruf isuruf commented Jul 7, 2018

Copy link
Copy Markdown
Contributor

Fixes #7427

@mattip

mattip commented Jul 7, 2018

Copy link
Copy Markdown
Member

It seems EnvironmentConfig is used only by fcompiler (quick check in scipy and astropy shows they do not use this). Perhaps it would make sense to move environment.py into the fcompiler directory to make that more clear? If there is a concern that moving the file breaks downstream code, then this change would also break such code.

Should have a test somewhere in distutils/tests (perhaps using subprocess and passing in env dictionary)

@rgommers rgommers added this to the 1.16.0 release milestone Jul 7, 2018
@mattip

mattip commented Jul 8, 2018

Copy link
Copy Markdown
Member

small nit - would be nice to have a test of dump_variables, otherwise LGTM and nicely fixes a longstanding problem

@isuruf

isuruf commented Jul 8, 2018

Copy link
Copy Markdown
Contributor Author

would be nice to have a test of dump_variables

How would I do that? capture stdout?

try:
var = ' '.join(var + envvar_contents)
except TypeError:
var = ' '.join([var] + envvar_contents)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why the try catch is needed? Specifically, give an example of when var is a list and is a string.

Why was this string / list uncertainty not a problem before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

envvar_contents = [envvar_contents]
if append and os.environ.get('NPY_DISTUTILS_APPEND_FLAGS', '0') == '1':
if var is None:
var = ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be var = [], in order to avoid an extra space appearing? Does this also remove the need for the try/catch?

@rgommers
rgommers merged commit 26311ed into numpy:master Jul 14, 2018
@rgommers

Copy link
Copy Markdown
Member

All looks good now, thanks @isuruf!

rgommers added a commit to rgommers/numpy that referenced this pull request Jul 14, 2018
@isuruf

isuruf commented Jul 14, 2018

Copy link
Copy Markdown
Contributor Author

Thanks everyone for the reviews

mattip added a commit that referenced this pull request Jul 15, 2018
DOC: update release notes for LDFLAGS append behavior (gh-11525).
@charris charris changed the title Append *FLAGS instead of overriding MAINT: Append *FLAGS instead of overriding Nov 10, 2018
@rgommers

Copy link
Copy Markdown
Member

gh-14250 switches the default behavior to append for 1.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fortran extensions on OSX, issue with defining LDFLAGS

4 participants