From fabb3e2c8f848e9db6e22319f6525ce217f09024 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Tue, 16 Jun 2020 13:49:44 -0700 Subject: [PATCH] script to build pypi package --- .gitignore | 3 +++ PythonAPI/MANIFEST.in | 1 + PythonAPI/common | 1 + PythonAPI/setup.py | 22 ++++++++++++++++------ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 PythonAPI/MANIFEST.in create mode 120000 PythonAPI/common diff --git a/.gitignore b/.gitignore index 640f4ce..8a1f207 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ PythonAPI/pycocotools/_mask.so PythonAPI/pycocotools/coco.pyc PythonAPI/pycocotools/cocoeval.pyc PythonAPI/pycocotools/mask.pyc + +dist/ +*.egg-info diff --git a/PythonAPI/MANIFEST.in b/PythonAPI/MANIFEST.in new file mode 100644 index 0000000..8d72b3e --- /dev/null +++ b/PythonAPI/MANIFEST.in @@ -0,0 +1 @@ +graft ./common diff --git a/PythonAPI/common b/PythonAPI/common new file mode 120000 index 0000000..60d3b0a --- /dev/null +++ b/PythonAPI/common @@ -0,0 +1 @@ +../common \ No newline at end of file diff --git a/PythonAPI/setup.py b/PythonAPI/setup.py index dbf0093..4ab14b5 100644 --- a/PythonAPI/setup.py +++ b/PythonAPI/setup.py @@ -1,27 +1,37 @@ -from setuptools import setup, Extension -import numpy as np - +from setuptools import dist, setup, Extension # To compile and install locally run "python setup.py build_ext --inplace" # To install library to Python site-packages run "python setup.py build_ext install" + +setup_requires=[ + 'setuptools>=18.0', + 'cython>=0.27.3', + 'numpy', +] +dist.Distribution().fetch_build_eggs(setup_requires) + +import numpy as np + ext_modules = [ Extension( 'pycocotools._mask', - sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'], - include_dirs = [np.get_include(), '../common'], + sources=['./common/maskApi.c', 'pycocotools/_mask.pyx'], + include_dirs = [np.get_include(), './common'], extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'], ) ] setup( name='pycocotools', + description='Official APIs for the MS-COCO dataset', packages=['pycocotools'], package_dir = {'pycocotools': 'pycocotools'}, + setup_requires=setup_requires, install_requires=[ 'setuptools>=18.0', 'cython>=0.27.3', 'matplotlib>=2.1.0' ], - version='2.0', + version='2.0.1', ext_modules= ext_modules )