File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,3 +105,5 @@ venv.bak/
105105
106106# Project-specific
107107pypict /capi.cpp
108+ pypict /pict
109+ wheelhouse /
Original file line number Diff line number Diff line change 1+ #! /bin/bash -uex
2+
3+ # Build wheels using manylinux1 Docker image provided by PyPA:
4+ # https://github.com/pypa/manylinux
5+
6+ PKG_DIR=" $( cd " $( dirname $0 ) " ; pwd) "
7+
8+ function run_manylinux() {
9+ docker run \
10+ --rm \
11+ --user $( id -u) :$( id -g) \
12+ --volume " ${PKG_DIR} :/package" \
13+ --workdir /package \
14+ quay.io/pypa/manylinux1_x86_64 \
15+ " $@ "
16+ }
17+
18+ rm -rf dist wheelhouse
19+ for PYTHON in cp27-cp27m cp27-cp27mu cp34-cp34m cp35-cp35m cp36-cp36m; do
20+ run_manylinux sh -uex -c "
21+ export PATH=/opt/python/${PYTHON} /bin:\$ {PATH}
22+ export HOME=/tmp
23+ export LD_LIBRARY_PATH=\$ {PWD}/pict
24+
25+ pip install --user 'Cython==0.28.3'
26+ rm -rf dist
27+ python setup.py build_pict test bdist_wheel --package-command
28+
29+ auditwheel --verbose repair dist/*-*-${PYTHON} -linux_x86_64.whl
30+ "
31+ done
Original file line number Diff line number Diff line change 11import csv
22import io
3+ import os
34import subprocess
45import tempfile
56
67
8+ _PICT = 'pict'
9+
10+
11+ def _get_pict_command ():
12+ pictcmd = os .path .join (os .path .dirname (__file__ ), _PICT )
13+ if os .path .exists (pictcmd ):
14+ return pictcmd
15+ return _PICT
16+
17+
718def _pict (model_file , order = None , random_seed = None ):
819 # TODO: support more options
9- cmdline = ['pict' , model_file ]
20+ cmdline = [_get_pict_command () , model_file ]
1021 if order is not None :
1122 cmdline += ['/o:{}' .format (order )]
1223 if random_seed is not None :
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3+ import shutil
34import subprocess
5+ import sys
46
57from setuptools import setup , Command , Extension
68from Cython .Build import cythonize
79
810
11+ package_command = False
12+
13+
914class BuildPictCommand (Command ):
1015
1116 description = 'build PICT shared library'
@@ -18,7 +23,19 @@ def finalize_options(self):
1823 pass
1924
2025 def run (self ):
26+ subprocess .check_call (['make' , '-C' , 'pict' , 'clean' ])
2127 subprocess .check_call (['make' , '-C' , 'pict' , 'libpict.so' ])
28+ if package_command :
29+ subprocess .check_call (['make' , '-C' , 'pict' , 'pict' ])
30+ shutil .copy2 ('pict/pict' , 'pypict/pict' )
31+
32+
33+ package_data = {}
34+
35+ if '--package-command' in sys .argv :
36+ sys .argv .remove ('--package-command' )
37+ package_command = True
38+ package_data = {'pypict' : ['pict' ]}
2239
2340
2441with open ('pypict/_version.py' ) as f :
@@ -35,6 +52,7 @@ def run(self):
3552 packages = [
3653 'pypict' ,
3754 ],
55+ package_data = package_data ,
3856 test_suite = 'tests' ,
3957 ext_modules = cythonize (
4058 Extension (
You can’t perform that action at this time.
0 commit comments