Skip to content
Merged
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
13 changes: 3 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2003,16 +2003,9 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
ffi_inc = find_file('ffi.h', [], inc_dirs)
if ffi_inc is not None:

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.

I haven't checked the implementation of find_file, but it looks like it probably takes care of the os.path.exists check and I'm not sure that the printed message is worth a whole lot in the grand spam of things. Could you check on that and probably just remove this whole branch?

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.

@zware: the problem is that find_file does not always get called and moreover that message may be useful to pinpoint a build problem,

ffi_h = ffi_inc[0] + '/ffi.h'
with open(ffi_h) as f:
for line in f:
line = line.strip()
if line.startswith(('#define LIBFFI_H',
'#define ffi_wrapper_h')):
break
else:
ffi_inc = None
print('Header file {} does not define LIBFFI_H or '
'ffi_wrapper_h'.format(ffi_h))
if not os.path.exists(ffi_h):
ffi_inc = None
print('Header file {} does not exist'.format(ffi_h))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.

But we need a proper commit message describing this change. The previous patch commit message is not relevant any more, and this patch commit message is not useful. People looking at python git history should not have to search github pull requests comments.

I think the proper way to do this would be to fixup this change into the previous patch, and upgrade the commit message to describe the actual change.

ffi_lib = None
if ffi_inc is not None:
for lib_name in ('ffi', 'ffi_pic'):
Expand Down