From 44701afe591023c1ed823e388e227b7cda95d2b9 Mon Sep 17 00:00:00 2001 From: Dimiter Naydenov Date: Tue, 29 Oct 2019 08:39:03 +0200 Subject: [PATCH] Travis build --- .travis.yml | 9 ++-- Pipfile | 3 -- Pipfile.lock | 111 ++++++++++++++------------------------------ build_wheels.sh | 22 +++++++++ setup.py | 2 +- tasks.py | 27 +---------- tox.ini | 2 +- xmlstarlet_build.py | 6 ++- 8 files changed, 70 insertions(+), 112 deletions(-) create mode 100644 build_wheels.sh diff --git a/.travis.yml b/.travis.yml index 06b5c311..187164ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,12 @@ python: - 3.6 - 3.5 - 3.4 -- 2.7 -install: pip install -U tox-travis -script: tox +install: +- docker pull quay.io/pypa/manylinux1_x86_64 + +script: +- docker run --rm -e PLAT=manylinux2010_x86_64 -v `pwd`:/io quay.io/pypa/manylinux2010_x86_64:latest /io/build_wheels.sh + deploy: provider: pypi distributions: sdist bdist_wheel diff --git a/Pipfile b/Pipfile index 6d51da24..7dbf5456 100644 --- a/Pipfile +++ b/Pipfile @@ -16,6 +16,3 @@ pylint = "*" pytest = "*" isort = "*" black = "==19.3b0" - -[packages] -xmlstarlet_cffi = {path = ".", editable = true} diff --git a/Pipfile.lock b/Pipfile.lock index 85edd08d..4ae2f46e 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "96e3f255cade25d272daffb601e49108cd249642abf7caf1c2704357dba0e888" + "sha256": "7162400259156c42bc57c42c06016afbe46e4f523bb9f8f265744613d8638715" }, "pipfile-spec": 6, "requires": {}, @@ -13,53 +13,7 @@ } ] }, - "default": { - "cffi": { - "hashes": [ - "sha256:00d890313797d9fe4420506613384b43099ad7d2b905c0752dbcc3a6f14d80fa", - "sha256:0cf9e550ac6c5e57b713437e2f4ac2d7fd0cd10336525a27224f5fc1ec2ee59a", - "sha256:0ea23c9c0cdd6778146a50d867d6405693ac3b80a68829966c98dd5e1bbae400", - "sha256:193697c2918ecdb3865acf6557cddf5076bb39f1f654975e087b67efdff83365", - "sha256:1ae14b542bf3b35e5229439c35653d2ef7d8316c1fffb980f9b7647e544baa98", - "sha256:1e389e069450609c6ffa37f21f40cce36f9be7643bbe5051ab1de99d5a779526", - "sha256:263242b6ace7f9cd4ea401428d2d45066b49a700852334fd55311bde36dcda14", - "sha256:33142ae9807665fa6511cfa9857132b2c3ee6ddffb012b3f0933fc11e1e830d5", - "sha256:364f8404034ae1b232335d8c7f7b57deac566f148f7222cef78cf8ae28ef764e", - "sha256:47368f69fe6529f8f49a5d146ddee713fc9057e31d61e8b6dc86a6a5e38cecc1", - "sha256:4895640844f17bec32943995dc8c96989226974dfeb9dd121cc45d36e0d0c434", - "sha256:558b3afef987cf4b17abd849e7bedf64ee12b28175d564d05b628a0f9355599b", - "sha256:5ba86e1d80d458b338bda676fd9f9d68cb4e7a03819632969cf6d46b01a26730", - "sha256:63424daa6955e6b4c70dc2755897f5be1d719eabe71b2625948b222775ed5c43", - "sha256:6381a7d8b1ebd0bc27c3bc85bc1bfadbb6e6f756b4d4db0aa1425c3719ba26b4", - "sha256:6381ab708158c4e1639da1f2a7679a9bbe3e5a776fc6d1fd808076f0e3145331", - "sha256:6fd58366747debfa5e6163ada468a90788411f10c92597d3b0a912d07e580c36", - "sha256:728ec653964655d65408949b07f9b2219df78badd601d6c49e28d604efe40599", - "sha256:7cfcfda59ef1f95b9f729c56fe8a4041899f96b72685d36ef16a3440a0f85da8", - "sha256:819f8d5197c2684524637f940445c06e003c4a541f9983fd30d6deaa2a5487d8", - "sha256:825ecffd9574557590e3225560a8a9d751f6ffe4a49e3c40918c9969b93395fa", - "sha256:9009e917d8f5ef780c2626e29b6bc126f4cb2a4d43ca67aa2b40f2a5d6385e78", - "sha256:9c77564a51d4d914ed5af096cd9843d90c45b784b511723bd46a8a9d09cf16fc", - "sha256:a19089fa74ed19c4fe96502a291cfdb89223a9705b1d73b3005df4256976142e", - "sha256:a40ed527bffa2b7ebe07acc5a3f782da072e262ca994b4f2085100b5a444bbb2", - "sha256:bb75ba21d5716abc41af16eac1145ab2e471deedde1f22c6f99bd9f995504df0", - "sha256:e22a00c0c81ffcecaf07c2bfb3672fa372c50e2bd1024ffee0da191c1b27fc71", - "sha256:e55b5a746fb77f10c83e8af081979351722f6ea48facea79d470b3731c7b2891", - "sha256:ec2fa3ee81707a5232bf2dfbd6623fdb278e070d596effc7e2d788f2ada71a05", - "sha256:fd82eb4694be712fcae03c717ca2e0fc720657ac226b80bbb597e971fc6928c2" - ], - "version": "==1.13.1" - }, - "pycparser": { - "hashes": [ - "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" - ], - "version": "==2.19" - }, - "xmlstarlet-cffi": { - "editable": true, - "path": "." - } - }, + "default": {}, "develop": { "alabaster": { "hashes": [ @@ -209,11 +163,11 @@ }, "flake8": { "hashes": [ - "sha256:19241c1cbc971b9962473e4438a2ca19749a7dd002dd1a946eaba171b4114548", - "sha256:8e9dfa3cecb2400b3738a42c54c3043e821682b9c840b0448c0503f781130696" + "sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb", + "sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca" ], "index": "pypi", - "version": "==3.7.8" + "version": "==3.7.9" }, "idna": { "hashes": [ @@ -263,26 +217,29 @@ }, "lazy-object-proxy": { "hashes": [ - "sha256:02b260c8deb80db09325b99edf62ae344ce9bc64d68b7a634410b8e9a568edbf", - "sha256:18f9c401083a4ba6e162355873f906315332ea7035803d0fd8166051e3d402e3", - "sha256:1f2c6209a8917c525c1e2b55a716135ca4658a3042b5122d4e3413a4030c26ce", - "sha256:2f06d97f0ca0f414f6b707c974aaf8829c2292c1c497642f63824119d770226f", - "sha256:616c94f8176808f4018b39f9638080ed86f96b55370b5a9463b2ee5c926f6c5f", - "sha256:63b91e30ef47ef68a30f0c3c278fbfe9822319c15f34b7538a829515b84ca2a0", - "sha256:77b454f03860b844f758c5d5c6e5f18d27de899a3db367f4af06bec2e6013a8e", - "sha256:83fe27ba321e4cfac466178606147d3c0aa18e8087507caec78ed5a966a64905", - "sha256:84742532d39f72df959d237912344d8a1764c2d03fe58beba96a87bfa11a76d8", - "sha256:874ebf3caaf55a020aeb08acead813baf5a305927a71ce88c9377970fe7ad3c2", - "sha256:9f5caf2c7436d44f3cec97c2fa7791f8a675170badbfa86e1992ca1b84c37009", - "sha256:a0c8758d01fcdfe7ae8e4b4017b13552efa7f1197dd7358dc9da0576f9d0328a", - "sha256:a4def978d9d28cda2d960c279318d46b327632686d82b4917516c36d4c274512", - "sha256:ad4f4be843dace866af5fc142509e9b9817ca0c59342fdb176ab6ad552c927f5", - "sha256:ae33dd198f772f714420c5ab698ff05ff900150486c648d29951e9c70694338e", - "sha256:b4a2b782b8a8c5522ad35c93e04d60e2ba7f7dcb9271ec8e8c3e08239be6c7b4", - "sha256:c462eb33f6abca3b34cdedbe84d761f31a60b814e173b98ede3c81bb48967c4f", - "sha256:fd135b8d35dfdcdb984828c84d695937e58cc5f49e1c854eb311c4d6aa03f4f1" - ], - "version": "==1.4.2" + "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", + "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", + "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", + "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", + "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", + "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", + "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", + "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", + "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", + "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", + "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", + "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", + "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", + "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", + "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", + "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", + "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", + "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", + "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", + "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", + "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" + ], + "version": "==1.4.3" }, "markupsafe": { "hashes": [ @@ -397,11 +354,11 @@ }, "pytest": { "hashes": [ - "sha256:7e4800063ccfc306a53c461442526c5571e1462f61583506ce97e4da6a1d88c8", - "sha256:ca563435f4941d0cb34767301c27bc65c510cb82e90b9ecf9cb52dc2c63caaa0" + "sha256:27abc3fef618a01bebb1f0d6d303d2816a99aa87a5968ebc32fe971be91eb1e6", + "sha256:58cee9e09242937e136dbb3dab466116ba20d6b7828c7620f23947f37eb4dae4" ], "index": "pypi", - "version": "==5.2.1" + "version": "==5.2.2" }, "pytz": { "hashes": [ @@ -447,11 +404,11 @@ }, "sphinx": { "hashes": [ - "sha256:0d586b0f8c2fc3cc6559c5e8fd6124628110514fda0e5d7c82e682d749d2e845", - "sha256:839a3ed6f6b092bb60f492024489cc9e6991360fb9f52ed6361acd510d261069" + "sha256:31088dfb95359384b1005619827eaee3056243798c62724fd3fa4b84ee4d71bd", + "sha256:52286a0b9d7caa31efee301ec4300dbdab23c3b05da1c9024b4e84896fb73d79" ], "index": "pypi", - "version": "==2.2.0" + "version": "==2.2.1" }, "sphinxcontrib-applehelp": { "hashes": [ diff --git a/build_wheels.sh b/build_wheels.sh new file mode 100644 index 00000000..5b0bf08d --- /dev/null +++ b/build_wheels.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e -x + +# Install a system package required by our library +yum install -y libxslt-devel + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install -r /io/requirements.txt + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ +done + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/*.whl; do + auditwheel repair "$whl" --plat $PLAT -w /io/wheelhouse/ +done + +# Install packages and test +for PYBIN in /opt/python/*/bin/; do + "${PYBIN}/pip" install xmlstarlet --no-index -f /io/wheelhouse + (cd "$HOME"; "${PYBIN}/pytest" -v) +done diff --git a/setup.py b/setup.py index 2eee8406..2c3f18df 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ requirements = ["cffi>=1.0.0"] -setup_requirements = ["pytest-runner", "cffi>=1.0.0"] +setup_requirements = ["pytest-runner", "setuptools", "wheel", "cffi>=1.0.0"] test_requirements = ["pytest"] diff --git a/tasks.py b/tasks.py index 38d23a40..48589ffa 100644 --- a/tasks.py +++ b/tasks.py @@ -153,7 +153,7 @@ def clean_tests(c): shutil.rmtree(COVERAGE_DIR, ignore_errors=True) -@task(pre=[clean_build, clean_python, clean_c, clean_tests, clean_docs]) +@task(pre=[clean_build, clean_python, clean_tests, clean_docs]) def clean(c): """ Runs all clean sub-tasks @@ -163,31 +163,8 @@ def clean(c): @task def dist_c(c): - c.run( - "cd libxml2 " - "&& autoreconf -sif " - "&& ./configure " - "--prefix=/usr " - "--without-lzma " - "&& make -j " - # "&& make tests || true " - "; cd .." - ) - c.run( - "cd libxslt " - "&& autoreconf -sif " - "&& ./configure " - "--prefix=/usr " - "--with-libxml-src=$(pwd)/../libxml2 " - "&& make -j " - # "&& make tests || true " - "; cd .." - ) c.run("cd xmlstar " "&& autoreconf -sif " - "&& ./configure " - "--with-libxml-src=$(pwd)/../libxml2 " - "--with-libxslt-src=$(pwd)/../libxslt " "--enable-static-libs " "--enable-maintainer-mode " "--prefix=/usr " @@ -197,7 +174,7 @@ def dist_c(c): -@task(pre=[dist_c]) +@task def dist(c): """ Build source and wheel packages diff --git a/tox.ini b/tox.ini index a8f3cfc2..834d1a10 100644 --- a/tox.ini +++ b/tox.ini @@ -23,4 +23,4 @@ setenv = deps = pipenv commands_pre = pipenv install --dev -commands = invoke clean dist test +commands = invoke dist test diff --git a/xmlstarlet_build.py b/xmlstarlet_build.py index 72104639..5f540aa4 100644 --- a/xmlstarlet_build.py +++ b/xmlstarlet_build.py @@ -11,14 +11,15 @@ C_SOURCE_DIR = os.path.relpath(os.path.join(ROOT_DIR, "xmlstar"), ROOT_DIR) LIBRARIES = ["xml2", "xslt", "exslt"] +LIBRARY_DIRS = ["/usr/lib64"] SOURCES = [ os.path.relpath(s, ROOT_DIR) for s in glob(os.path.join(ROOT_DIR, C_SOURCE_DIR, "src", "*")) if s.endswith(".c") ] INCLUDE_DIRS = [ - os.path.join(ROOT_DIR, "libxml2", "include"), - os.path.join(ROOT_DIR, "libxslt"), + "/usr/include", + "/usr/include/libxml2", os.path.join(ROOT_DIR, C_SOURCE_DIR), os.path.join(ROOT_DIR, C_SOURCE_DIR, "src"), ] @@ -57,6 +58,7 @@ sources=SOURCES, include_dirs=INCLUDE_DIRS, libraries=LIBRARIES, + library_dirs=LIBRARY_DIRS, )