Skip to content

Commit

Permalink
1.0.26b5 (2022-09-10)
Browse files Browse the repository at this point in the history
---------------------
- Tox configuration has been moved to pyproject.toml
  • Loading branch information
karpierz committed Sep 11, 2022
1 parent dac5bd3 commit 21291ec
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 118 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.0.26b5 (2022-09-10)
---------------------
- Tox configuration has been moved to pyproject.toml

1.0.26b4 (2022-08-25)
---------------------
- | Downgrade of included shared libraries for Linux:
Expand Down
116 changes: 115 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires = ['setuptools>=63.2.0', 'wheel>=0.37.1', 'packaging>=21.3.0', 'tox>=3.

[project]
name = 'libusb'
version = '1.0.26b4'
version = '1.0.26b5'
description = 'Python binding for the libusb C library.'
license = { text = 'zlib/libpng License ; https://opensource.org/licenses/Zlib' }
authors = [
Expand Down Expand Up @@ -162,3 +162,117 @@ count = true
#show-source
#verbose
#quiet

#
# Configuration(s) for tox
#

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{37,38,39,310,311}, pypy{37,38,39}, coverage, docs
minversion = 3.24.5
isolated_build = True
skip_missing_interpreters = true
requires =
tox-venv>=0.4.0
tox-backticks>=0.3.0
tox-tags>=0.2.0
tox-run-before>=0.1.0
{[base]setup_requires}
[base]
setup_requires =
pip>=21.2.4
setuptools>=63.2.0
wheel>=0.37.1
packagesubdir = libusb
[testenv]
passenv = WINDIR
commands =
{envpython} --version
{envpython} -B -m tests {posargs}
extras = test
deps =
{[base]setup_requires}
[testenv:prepare]
basepython = python3.7
skip_install = true
allowlist_externals =
cmd
.build
commands =
cmd /C if exist .build.cmd .build.cmd
[testenv:coverage]
basepython = python3.7
commands =
{envpython} -m coverage erase
-{envpython} -B -m coverage run -m tests {posargs}
{envpython} -m coverage report
{envpython} -m coverage html
deps =
{[testenv]deps}
coverage>=6.4.4
diff-cover>=6.5.1
[testenv:docs]
basepython = python3.7
commands =
#{envpython} -m sphinx.apidoc -f {envsitepackagesdir}/{[base]packagesubdir}
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b html -E
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b linkcheck
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b doctest
extras = doc
deps =
[testenv:build]
basepython = python3.7
setenv =
PKG_PVER=`{envpython} -c "import platform ; print(''.join(platform.python_version_tuple()[:2]))" 2> nul`
PKG_NAME=`{envpython} -c "import warnings ; warnings.filterwarnings('ignore') ;import setuptools ; setuptools._distutils.core._setup_stop_after='config' ; print(setuptools.setup().metadata.get_name(), end='')" 2> nul`
PKG_DIST=`{envpython} -c "import warnings ; warnings.filterwarnings('ignore') ;import setuptools ; setuptools._distutils.core._setup_stop_after='config' ; print(setuptools.setup().metadata.get_fullname(), end='')" 2> nul`
commands =
{[testenv]commands}
{[testenv:docs]commands}
{envpython} -c "from setuptools import setup ; setup()" --quiet sdist --formats=zip
{envpython} -c "from setuptools import setup ; setup()" --quiet bdist_wheel
# check out for PyPi
{envpython} -m twine check dist/*
extras =
{[testenv]extras}
{[testenv:docs]extras}
deps =
{[testenv]deps}
{[testenv:docs]deps}
twine>=4.0.1
[testenv:publish]
basepython = python3.7
setenv =
{[testenv:build]setenv}
commands =
{[testenv:build]commands}
# publish on PyPi
{envpython} -m twine upload dist/*
extras =
{[testenv:build]extras}
deps =
{[testenv:build]deps}
twine>=4.0.1
[testenv:lint]
basepython = python3.7
commands =
{envpython} -m flake8p {envsitepackagesdir}/{[base]packagesubdir}/
extras =
deps =
{[testenv]deps}
flake8>=5.0.4
flake8-pyproject>=1.1.0.post0
flake8-docstrings>=1.6.0
pep8-naming>=0.13.2
flake8-builtins>=1.5.3
"""
111 changes: 0 additions & 111 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,114 +8,3 @@ build-dir = build/docs
builder = html
all-files = True
warning-is-error = True

#
# Configuration(s) for tox
#

[tox:tox]
envlist = py{37,38,39,310,311}, pypy{37,38,39}, coverage, docs
minversion = 3.24.5
isolated_build = True
skip_missing_interpreters = true
requires =
tox-venv>=0.4.0
tox-backticks>=0.3.0
tox-tags>=0.2.0
tox-run-before>=0.1.0
{[base]setup_requires}

[base]
setup_requires =
pip>=21.2.4
setuptools>=63.2.0
wheel>=0.37.1
packagesubdir = libusb

[testenv]
passenv = WINDIR
commands =
{envpython} --version
{envpython} -B -m tests {posargs}
extras = test
deps =
{[base]setup_requires}

[testenv:prepare]
basepython = python3.7
skip_install = true
allowlist_externals =
cmd
.build
commands =
cmd /C if exist .build.cmd .build.cmd

[testenv:coverage]
basepython = python3.7
commands =
{envpython} -m coverage erase
-{envpython} -B -m coverage run -m tests {posargs}
{envpython} -m coverage report
{envpython} -m coverage html
deps =
{[testenv]deps}
coverage>=6.4.4
diff-cover>=6.5.1

[testenv:docs]
basepython = python3.7
commands =
#{envpython} -m sphinx.apidoc -f {envsitepackagesdir}/{[base]packagesubdir}
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b html -E
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b linkcheck
{envpython} -c "from setuptools import setup ; setup()" -v build_sphinx -b doctest
extras = doc
deps =

[testenv:build]
basepython = python3.7
setenv =
PKG_NAME=`{envpython} -c "from setuptools import setup ; setup()" --fullname`
PKG_DIST=`{envpython} -c 'print("""{env:PKG_NAME}""".strip(), end="")'`
PKG_PVER=`{envpython} -c 'import platform ; print("".join(platform.python_version_tuple()[:2]))'`
commands =
{[testenv]commands}
{[testenv:docs]commands}
{envpython} -c "from setuptools import setup ; setup()" --quiet sdist --formats=zip
{envpython} -c "from setuptools import setup ; setup()" --quiet bdist_wheel
# check out for PyPi
{envpython} -m twine check dist/*
extras =
{[testenv]extras}
{[testenv:docs]extras}
deps =
{[testenv]deps}
{[testenv:docs]deps}
twine>=4.0.1

[testenv:publish]
basepython = python3.7
setenv =
{[testenv:build]setenv}
commands =
{[testenv:build]commands}
# publish on PyPi
{envpython} -m twine upload dist/*
extras =
{[testenv:build]extras}
deps =
{[testenv:build]deps}
twine>=4.0.1

[testenv:lint]
basepython = python3.7
commands =
{envpython} -m flake8p {envsitepackagesdir}/{[base]packagesubdir}/
extras =
deps =
{[testenv]deps}
flake8>=5.0.4
flake8-pyproject>=1.1.0.post0
flake8-docstrings>=1.6.0
pep8-naming>=0.13.2
flake8-builtins>=1.5.3
16 changes: 10 additions & 6 deletions src/libusb/_platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@
import sys
import os
import platform
import ctypes as ct

is_windows = (bool(platform.win32_ver()[0])
or (sys.platform in ("win32", "cygwin"))
or (sys.platform in ("win32", "cygwin", "msys"))
or (sys.platform == "cli" and os.name in ("nt", "ce"))
or (os.name == "java"
and "windows" in platform.java_ver()[3][0].lower()))
is_linux = sys.platform.startswith("linux")
is_macos = (sys.platform == "darwin")
is_android = False
is_android = hasattr(sys, "getandroidapilevel")
is_posix = (os.name == "posix")
is_32bit = (sys.maxsize <= 2**32)

def defined(varname, __getframe=sys._getframe):
frame = __getframe(1)
return varname in frame.f_locals or varname in frame.f_globals

del sys, os, platform
def from_oid(oid, __cast=ct.cast, __py_object=ct.py_object):
return __cast(oid, __py_object).value if oid else None

del sys, os, platform, ct

if is_windows:
from ._windows import DLL_PATH, DLL, dlclose, CFUNC
from ._windows import timeval
from ._windows import time_t, timeval
elif is_linux:
from ._linux import DLL_PATH, DLL, dlclose, CFUNC
from ._linux import timeval
from ._linux import time_t, timeval
elif is_macos:
from ._macos import DLL_PATH, DLL, dlclose, CFUNC
from ._macos import timeval
from ._macos import time_t, timeval
else:
raise ImportError("unsupported platform")
2 changes: 2 additions & 0 deletions src/libusb/_platform/_windows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
dlclose = lambda handle: 0
from ctypes import WINFUNCTYPE as CFUNC # noqa: E402

time_t = ct.c_uint64

# Winsock doesn't have this POSIX type; it's used for the
# tv_usec value of struct timeval.
suseconds_t = ct.c_long
Expand Down
Empty file added tests/data/.keep
Empty file.

0 comments on commit 21291ec

Please sign in to comment.