From 076150fb6caf9fa361a8b63c2239d153f48b8d1c Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 00:14:24 +0000 Subject: [PATCH 1/8] Add github actions status badge to README --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 15ba444..b9dcfa7 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,8 @@ python-lz4 Status ====== -.. image:: https://travis-ci.org/python-lz4/python-lz4.svg?branch=master - :target: https://travis-ci.org/python-lz4/python-lz4 +.. image:: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml/badge.svg + :target: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml :alt: Build Status .. image:: https://ci.appveyor.com/api/projects/status/r2qvw9mlfo63lklo/branch/master?svg=true From 8a4aa23aca1255de5e29fc09994b0a8cd7c404a5 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 00:29:53 +0000 Subject: [PATCH 2/8] Remove AppVeyor badge from README --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index b9dcfa7..a75bc4d 100644 --- a/README.rst +++ b/README.rst @@ -9,10 +9,6 @@ Status :target: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml :alt: Build Status -.. image:: https://ci.appveyor.com/api/projects/status/r2qvw9mlfo63lklo/branch/master?svg=true - :target: https://ci.appveyor.com/project/jonathanunderwood/python-lz4 - :alt: Build Status Windows - .. image:: https://readthedocs.org/projects/python-lz4/badge/?version=stable :target: https://readthedocs.org/projects/python-lz4/ :alt: Documentation From d47235998c3f54d355646b61e7ff19a182f01ac5 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 20:40:20 +0000 Subject: [PATCH 3/8] Remove dependency on distutils (#236) --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2f2704f..b499e01 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ #!/usr/bin/env python import os from setuptools import setup, find_packages, Extension +from setuptools.command.build_ext import new_compiler import sys -from distutils import ccompiler + # Note: if updating LZ4_REQUIRED_VERSION you need to update docs/install.rst as # well. @@ -97,7 +98,7 @@ def pkgconfig_installed_check(lib, required_version, default): ] ) -compiler = ccompiler.get_default_compiler() +compiler = new_compiler().compiler_type if compiler == 'msvc': extension_kwargs['extra_compile_args'] = [ From acd7557dd837966961e02c3a958d04f700e3d8b8 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:39:49 +0000 Subject: [PATCH 4/8] Add env var to control building against system LZ4 --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b499e01..32f3434 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,13 @@ def pkgconfig_installed_check(lib, required_version, default): 'lz4/stream/_stream.c' ] -if liblz4_found is True: +use_system_liblz4_env = os.environ.get("PYLZ4_USE_SYSTEM_LZ4", "True") +if use_system_liblz4_env.upper() in ("1", "TRUE"): + use_system_liblz4 = True +else: + use_system_liblz4 = False + +if liblz4_found is True and use_system_liblz4 is True: extension_kwargs['libraries'] = ['lz4'] else: extension_kwargs['include_dirs'] = ['lz4libs'] From 9a1d7c2ef09b01c00db8da31fc36c0ca73e59a14 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:40:57 +0000 Subject: [PATCH 5/8] Force using bundled LZ4 when building wheels --- .github/workflows/build_dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 2c93cdd..c02e25e 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -53,6 +53,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.11.4 env: + PYLZ4_USE_SYSTEM_LZ4: "False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_MACOS: "x86_64 arm64" # universal2" CIBW_ARCHS_WINDOWS: "AMD64 x86" From 783967171cbfa6c29807cf21b9d64fbb9e86cbab Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:42:27 +0000 Subject: [PATCH 6/8] Clean up handling of PYLZ4_EXPERIMENTAL --- setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 32f3434..f793adf 100644 --- a/setup.py +++ b/setup.py @@ -36,12 +36,11 @@ def pkgconfig_installed_check(lib, required_version, default): liblz4_found = pkgconfig_installed_check('liblz4', LZ4_REQUIRED_VERSION, default=False) # Establish if we want to build experimental functionality or not. -experimental = os.environ.get("PYLZ4_EXPERIMENTAL", False) -if experimental is not False: - if experimental.upper() in ("1", "TRUE"): - experimental = True - else: - experimental = False +experimental_env = os.environ.get("PYLZ4_EXPERIMENTAL", "False") +if experimental_env.upper() in ("1", "TRUE"): + experimental = True +else: + experimental = False # Set up the extension modules. If a system wide lz4 library is found, and is # recent enough, we'll use that. Otherwise we'll build with the bundled one. If From d1a071add32e9140324f2729c783211471ecdfd9 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:59:46 +0000 Subject: [PATCH 7/8] Ensure PYLZ4_USE_SYSTEM_LZ4 env var passed to cibuildwheel --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index c02e25e..6fd9b2f 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -53,7 +53,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.11.4 env: - PYLZ4_USE_SYSTEM_LZ4: "False" + CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_MACOS: "x86_64 arm64" # universal2" CIBW_ARCHS_WINDOWS: "AMD64 x86" From b1b3afd4dc37816c1a93a471e89761f5256d45db Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 22:16:46 +0000 Subject: [PATCH 8/8] Don't link against system lz4 if PYLZ4_USE_SYSTEM_LZ4 is not True --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f793adf..387f5c8 100644 --- a/setup.py +++ b/setup.py @@ -113,7 +113,7 @@ def pkgconfig_installed_check(lib, required_version, default): '/wd4820', ] elif compiler in ('unix', 'mingw32'): - if liblz4_found: + if liblz4_found is True and use_system_liblz4 is True: extension_kwargs = pkgconfig_parse('liblz4') else: extension_kwargs['extra_compile_args'] = [