Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fixups #266

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

Merged
merged 8 commits into from
Dec 30, 2022
Merged
1 change: 1 addition & 0 deletions .github/workflows/build_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
env:
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"
Expand Down
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ 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
: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
Expand Down
26 changes: 16 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -35,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
Expand All @@ -67,7 +67,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']
Expand Down Expand Up @@ -97,7 +103,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'] = [
Expand All @@ -107,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'] = [
Expand Down