-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pypi installer support #380
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
21023a5
Update python bindings installer for pypi packaging. Installer has be…
tfcollins 71cc9cb
Add pypi to travis-ci providers for python bindings. Only the first x86
tfcollins 3ed4840
Update appveyor build to use sdist build instead of bdist_wininst
tfcollins 1725e42
Remove python bindings from windows installer. Pip will be used inste…
tfcollins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
language: c | ||
sudo: required | ||
python: "3.6" | ||
|
||
env: | ||
global: | ||
|
@@ -34,6 +35,7 @@ matrix: | |
# TODO do `check` or `check_hw` here too, not just `check_sw` (as part of `coverage`) | ||
- CHECK_RULE=coverage GCOV=1 | ||
- PKG_RULE=gzip | ||
- PYPI=yes | ||
- COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG" | ||
- COVERITY_SCAN_BRANCH_PATTERN="master" | ||
- COVERITY_SCAN_NOTIFICATION_EMAIL="[email protected]" | ||
|
@@ -113,6 +115,7 @@ before_deploy: | |
- eval "$(ssh-agent -s)" | ||
- chmod 600 /tmp/deploy.rsa | ||
- ssh-add /tmp/deploy.rsa | ||
- if [[ "$PYPI" == "yes" ]]; then cd "build/bindings/python"; fi | ||
deploy: | ||
- provider: releases | ||
api_key: | ||
|
@@ -151,6 +154,16 @@ deploy: | |
on: | ||
condition: "$TRAVIS_OS_NAME = osx" | ||
all_branches: true | ||
- provider: pypi | ||
if: tag IS present | ||
skip_cleanup: true | ||
on: | ||
tags: true | ||
condition: "$PYPI = yes" | ||
username: __token__ | ||
password: | ||
secure: KfORvnPyLlMANLpcwJjcO44Kt6meP614omJk2GloD+B51SuV64O6N31VDOTi2xqioEk9Cajq7tmNte5YoHVUjL9iWFsBblpzxZoXcy40dn4pFN0kMiE8scszxckbDwuBZhokUVZ2fhfLKf/8xORcwjS3vKqSj5HwQKKvVgukSbQ= | ||
distributions: sdist | ||
|
||
after_deploy: | ||
- ${TRAVIS_BUILD_DIR}/CI/travis/after_deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,77 @@ | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
|
||
from distutils.core import setup | ||
|
||
setup(name='libiio', | ||
version='${VERSION}', | ||
description='Library to use the Industrial IO devices', | ||
url='https://github.com/analogdevicesinc/libiio', | ||
py_modules=['iio'], | ||
) | ||
import sys | ||
|
||
if sys.version_info[0] < 3: | ||
from distutils.core import setup | ||
from distutils.command.install import install | ||
|
||
config = dict() | ||
else: | ||
from setuptools import setup | ||
from setuptools.command.install import install | ||
|
||
config = dict(long_description_content_type="text/markdown") | ||
|
||
description = "Library for interfacing with Linux IIO devices" | ||
|
||
try: | ||
with open("${CMAKE_SOURCE_DIR}/README.md", "r") as fh: | ||
long_description = fh.read() | ||
except: | ||
long_description = description | ||
|
||
|
||
class InstallWrapper(install): | ||
"""Before installing we check if the | ||
libiio library is actually installed""" | ||
|
||
def run(self): | ||
self._check_libiio_installed() | ||
# Run the standard PyPi copy | ||
install.run(self) | ||
|
||
def _check_libiio_installed(self): | ||
from platform import system as _system | ||
from ctypes import CDLL as _cdll | ||
from ctypes.util import find_library | ||
|
||
if "Windows" in _system(): | ||
_iiolib = "libiio.dll" | ||
else: | ||
# Non-windows, possibly Posix system | ||
_iiolib = "iio" | ||
try: | ||
_lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True) | ||
if not _lib._name: | ||
raise OSError | ||
except OSError: | ||
msg = "The libiio library could not be found.\n\ | ||
libiio needs to be installed first before the python bindings.\n\ | ||
The latest release can be found on GitHub:\n\ | ||
https://github.com/analogdevicesinc/libiio/releases" | ||
raise Exception(msg) | ||
|
||
|
||
config.update( | ||
dict( | ||
name="libiio", | ||
version="${VERSION}", | ||
maintainer="Analog Devices, Inc", | ||
maintainer_email="[email protected]", | ||
description=description, | ||
long_description=long_description, | ||
url="https://github.com/analogdevicesinc/libiio", | ||
py_modules=["iio"], | ||
cmdclass={"install": InstallWrapper}, | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", | ||
"Operating System :: OS Independent", | ||
], | ||
) | ||
) | ||
|
||
|
||
setup(**config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my only question here is: do we lose any test/build coverage by removing these?
and if yes, any way to compensate? we could also add a CI run somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could actually install the built wheel... This would require installing the dll (then removing it for each variant)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess it should work;
let's see later