From ef826db684b4728196dd8e8cd91c14244b1b9957 Mon Sep 17 00:00:00 2001 From: AeroXuk Date: Sat, 25 Nov 2017 13:38:19 +0000 Subject: [PATCH 1/2] Added conditional library name to allow building on windows. Removed -Wno-unused-function compiler arg which causes errors with msvc. --- setup.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 9f9b60d..c874f2a 100644 --- a/setup.py +++ b/setup.py @@ -25,19 +25,17 @@ def main(): ext_modules=[ Extension('postal._expand', sources=['postal/pyexpand.c'], - libraries=['postal'], + libraries=(["libpostal"] if sys.platform == 'win32' else ["postal"]), include_dirs=['/usr/local/include'], library_dirs=['/usr/local/lib'], - extra_compile_args=['-std=c99', - '-Wno-unused-function'], + extra_compile_args=['-std=c99'], ), Extension('postal._parser', sources=['postal/pyparser.c'], - libraries=['postal'], + libraries=(["libpostal"] if sys.platform == 'win32' else ["postal"]), include_dirs=['/usr/local/include'], library_dirs=['/usr/local/lib'], - extra_compile_args=['-std=c99', - '-Wno-unused-function'], + extra_compile_args=['-std=c99'], ), ], packages=find_packages(), From 60bd1fabaf518173ef8f279d4ad94afb8efed69a Mon Sep 17 00:00:00 2001 From: AeroXuk Date: Sat, 25 Nov 2017 23:22:26 +0000 Subject: [PATCH 2/2] Add libpostal.dll into python library bundle on windows. --- setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index c874f2a..4c17b0d 100644 --- a/setup.py +++ b/setup.py @@ -26,18 +26,19 @@ def main(): Extension('postal._expand', sources=['postal/pyexpand.c'], libraries=(["libpostal"] if sys.platform == 'win32' else ["postal"]), - include_dirs=['/usr/local/include'], - library_dirs=['/usr/local/lib'], + include_dirs=['/usr/local/include', './'], + library_dirs=['/usr/local/lib', './libpostal/'], extra_compile_args=['-std=c99'], ), Extension('postal._parser', sources=['postal/pyparser.c'], libraries=(["libpostal"] if sys.platform == 'win32' else ["postal"]), - include_dirs=['/usr/local/include'], - library_dirs=['/usr/local/lib'], + include_dirs=['/usr/local/include', './'], + library_dirs=['/usr/local/lib', './libpostal/'], extra_compile_args=['-std=c99'], ), ], + data_files=([("postal",["libpostal/libpostal.dll"])] if sys.platform == 'win32' else []), packages=find_packages(), zip_safe=False, url='https://github.com/openvenues/pypostal',