Skip to content

Commit 158e3c9

Browse files
committed
Add github actions to build python wheels
1 parent 92502dc commit 158e3c9

5 files changed

Lines changed: 101 additions & 67 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheel py${{matrix.python}} on ${{matrix.platform}}
8+
runs-on: ${{matrix.platform}}
9+
strategy:
10+
matrix:
11+
platform: [ubuntu-latest] # [ubuntu-latest, macos-latest, windows-latest]
12+
python: [39]
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Build wheels
16+
uses: pypa/cibuildwheel@v2.0.0
17+
- uses: actions/upload-artifact@v2
18+
with:
19+
path: ./wheelhouse/*.whl

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,6 @@ venv.bak/
103103

104104
# mypy
105105
.mypy_cache/
106+
107+
# vscode settings
108+
.vscode/

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel", "numpy", "Cython"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.cibuildwheel]
6+
before-all = "bash requirements/clone.bash && bash requirements/build.bash"
7+
before-build = "pip install numpy cython"
8+
manylinux-x86_64-image = "manylinux_2_24"
9+
test-requires = "pytest"
10+
test-command = "pytest {package}/test"

setup.cfg

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[metadata]
2+
name = python-fcl
3+
version = attr: fcl.__version__
4+
description = Python bindings for the Flexible Collision Library
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
url = https://github.com/CyrilWaechter/python-fcl
8+
maintainer = Cyril Waechter
9+
maintainer_email = cyrwae@hotmail.com
10+
license = BSD
11+
license_files = LICENSE
12+
classifiers =
13+
Development Status :: 3 - Alpha
14+
License :: OSI Approved :: BSD License
15+
Operating System :: POSIX :: Linux
16+
Programming Language :: Python :: 2
17+
Programming Language :: Python :: 2.7
18+
Programming Language :: Python :: 3
19+
Programming Language :: Python :: 3.0
20+
Programming Language :: Python :: 3.1
21+
Programming Language :: Python :: 3.2
22+
Programming Language :: Python :: 3.3
23+
Programming Language :: Python :: 3.4
24+
Programming Language :: Python :: 3.5
25+
Programming Language :: Python :: 3.6
26+
keywords = fcl collision distance
27+
packages = fcl
28+
setup_requires =
29+
numpy
30+
Cython
31+
install_requires =
32+
numpy
33+
Cython

setup.py

Lines changed: 36 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,52 @@
11
import os
22
import sys
3-
import inspect
43

54
from setuptools import Extension, setup
65

76

8-
# get current directory of file in case someone
9-
# called setup.py from elsewhere
10-
cwd = os.path.dirname(os.path.abspath(
11-
inspect.getfile(inspect.currentframe())))
12-
13-
# load __version__
14-
exec(open(os.path.join(cwd,
15-
'fcl/version.py'), 'r').read())
16-
17-
platform_supported = False
18-
for prefix in ['darwin', 'linux', 'bsd']:
19-
if prefix in sys.platform:
20-
platform_supported = True
21-
include_dirs = ['/usr/include',
22-
'/usr/local/include',
23-
'/usr/include/eigen3',
24-
'/usr/local/include/eigen3']
25-
lib_dirs = ['/usr/lib',
26-
'/usr/local/lib']
27-
28-
if 'CPATH' in os.environ:
29-
include_dirs += os.environ['CPATH'].split(':')
30-
if 'LD_LIBRARY_PATH' in os.environ:
31-
lib_dirs += os.environ['LD_LIBRARY_PATH'].split(':')
32-
33-
try:
34-
# get the numpy include path from numpy
35-
import numpy
36-
include_dirs.append(numpy.get_include())
37-
except:
38-
pass
39-
40-
break
41-
42-
if sys.platform == "win32":
7+
def get_include_dirs():
438
platform_supported = False
44-
45-
if not platform_supported:
9+
for prefix in ['darwin', 'linux', 'bsd']:
10+
if prefix in sys.platform:
11+
platform_supported = True
12+
include_dirs = ['/usr/include',
13+
'/usr/local/include',
14+
'/usr/include/eigen3',
15+
'/usr/local/include/eigen3']
16+
17+
if 'CPATH' in os.environ:
18+
include_dirs += os.environ['CPATH'].split(':')
19+
20+
break
21+
if sys.platform == "win32":
22+
platform_supported = False
23+
if not platform_supported:
24+
raise NotImplementedError(sys.platform)
25+
26+
# get the numpy include path from numpy
27+
import numpy
28+
include_dirs.append(numpy.get_include())
29+
return include_dirs
30+
31+
def get_libraries_dir():
32+
for prefix in ['darwin', 'linux', 'bsd']:
33+
if prefix in sys.platform:
34+
platform_supported = True
35+
lib_dirs = ['/usr/lib',
36+
'/usr/local/lib']
37+
38+
if 'LD_LIBRARY_PATH' in os.environ:
39+
lib_dirs += os.environ['LD_LIBRARY_PATH'].split(':')
40+
return lib_dirs
4641
raise NotImplementedError(sys.platform)
4742

43+
4844
setup(
49-
name='python-fcl',
50-
version=__version__,
51-
description='Python bindings for the Flexible Collision Library',
52-
long_description='Python bindings for the Flexible Collision Library',
53-
url='https://github.com/CyrilWaechter/python-fcl',
54-
author='Cyril Waechter',
55-
author_email='cyrwae@hotmail.com',
56-
license = "BSD",
57-
classifiers=[
58-
'Development Status :: 3 - Alpha',
59-
'License :: OSI Approved :: BSD License',
60-
'Operating System :: POSIX :: Linux',
61-
'Programming Language :: Python :: 2',
62-
'Programming Language :: Python :: 2.7',
63-
'Programming Language :: Python :: 3',
64-
'Programming Language :: Python :: 3.0',
65-
'Programming Language :: Python :: 3.1',
66-
'Programming Language :: Python :: 3.2',
67-
'Programming Language :: Python :: 3.3',
68-
'Programming Language :: Python :: 3.4',
69-
'Programming Language :: Python :: 3.5',
70-
'Programming Language :: Python :: 3.6',
71-
],
72-
keywords='fcl collision distance',
73-
packages=['fcl'],
74-
setup_requires=['cython'],
75-
install_requires=['numpy', 'cython'],
7645
ext_modules=[Extension(
7746
"fcl.fcl",
7847
["fcl/fcl.pyx"],
79-
include_dirs = include_dirs,
80-
library_dirs = lib_dirs,
48+
include_dirs = get_include_dirs(),
49+
library_dirs = get_libraries_dir(),
8150
libraries=[
8251
"fcl","octomap"
8352
],

0 commit comments

Comments
 (0)