python310Packages.jq: 1.2.3 -> 1.3.0
This commit is contained in:
parent
48932d3408
commit
dd538e9aed
2 changed files with 39 additions and 62 deletions
|
@ -1,12 +1,14 @@
|
||||||
{ buildPythonPackage, fetchPypi, lib, jq }:
|
{ lib, buildPythonPackage, fetchFromGitHub, cython, jq, pytestCheckHook }:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "jq";
|
pname = "jq";
|
||||||
version = "1.2.3";
|
version = "1.3.0";
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchFromGitHub {
|
||||||
inherit pname version;
|
owner = "mwilliamson";
|
||||||
sha256 = "sha256-15bXqaa6c6RMoHKqUAcOhPrhMBbqYHrDdnZAaFaHElc=";
|
repo = "jq.py";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-1EQm5ShjFHbO1IO5QD42fsGHFGDBrJulLrcl+WeU7wo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
|
@ -14,10 +16,18 @@ buildPythonPackage rec {
|
||||||
./jq-py-setup.patch
|
./jq-py-setup.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cython ];
|
||||||
|
|
||||||
buildInputs = [ jq ];
|
buildInputs = [ jq ];
|
||||||
|
|
||||||
# no tests executed
|
preBuild = ''
|
||||||
doCheck = false;
|
cython jq.pyx
|
||||||
|
'';
|
||||||
|
|
||||||
|
checkInputs = [
|
||||||
|
pytestCheckHook
|
||||||
|
];
|
||||||
|
|
||||||
pythonImportsCheck = [ "jq" ];
|
pythonImportsCheck = [ "jq" ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
From bef841b73ba7c9a79211146798ac888fce9bb55a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Robert T. McGibbon" <rmcgibbo@gmail.com>
|
|
||||||
Date: Fri, 7 May 2021 19:14:20 -0400
|
|
||||||
Subject: [PATCH 1/1] Vastly simplify setup.py for distro compatibility
|
|
||||||
|
|
||||||
---
|
|
||||||
setup.py | 98 +-------------------------------------------------------
|
|
||||||
1 file changed, 1 insertion(+), 97 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/setup.py b/setup.py
|
diff --git a/setup.py b/setup.py
|
||||||
index 663792c..3ebcabe 100644
|
index 01cc813..15e9048 100644
|
||||||
--- a/setup.py
|
--- a/setup.py
|
||||||
+++ b/setup.py
|
+++ b/setup.py
|
||||||
@@ -1,113 +1,19 @@
|
@@ -1,97 +1,18 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -20,50 +11,42 @@ index 663792c..3ebcabe 100644
|
||||||
-import shutil
|
-import shutil
|
||||||
-import sysconfig
|
-import sysconfig
|
||||||
|
|
||||||
-import requests
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
-from setuptools.command.build_ext import build_ext
|
-from setuptools.command.build_ext import build_ext
|
||||||
from setuptools.extension import Extension
|
from setuptools.extension import Extension
|
||||||
|
|
||||||
|
|
||||||
-def urlretrieve(source_url, destination_path):
|
|
||||||
- response = requests.get(source_url, stream=True)
|
|
||||||
- if response.status_code != 200:
|
|
||||||
- raise Exception("status code was: {}".format(response.status_code))
|
|
||||||
-
|
-
|
||||||
- with open(destination_path, "wb") as fileobj:
|
-def _path_in_dir(relative_path):
|
||||||
- for chunk in response.iter_content(chunk_size=128):
|
|
||||||
- fileobj.write(chunk)
|
|
||||||
-
|
|
||||||
-def path_in_dir(relative_path):
|
|
||||||
- return os.path.abspath(os.path.join(os.path.dirname(__file__), relative_path))
|
- return os.path.abspath(os.path.join(os.path.dirname(__file__), relative_path))
|
||||||
-
|
-
|
||||||
-def dependency_path(relative_path):
|
-def _dep_source_path(relative_path):
|
||||||
- return os.path.join(path_in_dir("_deps"), relative_path)
|
- return os.path.join(_path_in_dir("deps"), relative_path)
|
||||||
-
|
-
|
||||||
def read(fname):
|
-def _dep_build_path(relative_path):
|
||||||
|
- return os.path.join(_path_in_dir("_deps/build"), relative_path)
|
||||||
|
-
|
||||||
|
def _read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
|
|
||||||
|
|
||||||
-jq_lib_tarball_path = dependency_path("jq-lib-1.6.tar.gz")
|
-jq_lib_tarball_path = _dep_source_path("jq-1.6.tar.gz")
|
||||||
-jq_lib_dir = dependency_path("jq-1.6")
|
-jq_lib_dir = _dep_build_path("jq-1.6")
|
||||||
-
|
-
|
||||||
-oniguruma_version = "6.9.4"
|
-oniguruma_version = "6.9.4"
|
||||||
-oniguruma_lib_tarball_path = dependency_path("onig-{}.tar.gz".format(oniguruma_version))
|
-oniguruma_lib_tarball_path = _dep_source_path("onig-{}.tar.gz".format(oniguruma_version))
|
||||||
-oniguruma_lib_build_dir = dependency_path("onig-{}".format(oniguruma_version))
|
-oniguruma_lib_build_dir = _dep_build_path("onig-{}".format(oniguruma_version))
|
||||||
-oniguruma_lib_install_dir = dependency_path("onig-install-{}".format(oniguruma_version))
|
-oniguruma_lib_install_dir = _dep_build_path("onig-install-{}".format(oniguruma_version))
|
||||||
-
|
-
|
||||||
-class jq_build_ext(build_ext):
|
-class jq_build_ext(build_ext):
|
||||||
- def run(self):
|
- def run(self):
|
||||||
- if not os.path.exists(dependency_path(".")):
|
- if not os.path.exists(_dep_build_path(".")):
|
||||||
- os.makedirs(dependency_path("."))
|
- os.makedirs(_dep_build_path("."))
|
||||||
- self._build_oniguruma()
|
- self._build_oniguruma()
|
||||||
- self._build_libjq()
|
- self._build_libjq()
|
||||||
- build_ext.run(self)
|
- build_ext.run(self)
|
||||||
-
|
-
|
||||||
- def _build_oniguruma(self):
|
- def _build_oniguruma(self):
|
||||||
- self._build_lib(
|
- self._build_lib(
|
||||||
- source_url="https://github.com/kkos/oniguruma/releases/download/v{0}/onig-{0}.tar.gz".format(oniguruma_version),
|
|
||||||
- tarball_path=oniguruma_lib_tarball_path,
|
- tarball_path=oniguruma_lib_tarball_path,
|
||||||
- lib_dir=oniguruma_lib_build_dir,
|
- lib_dir=oniguruma_lib_build_dir,
|
||||||
- commands=[
|
- commands=[
|
||||||
|
@ -75,7 +58,6 @@ index 663792c..3ebcabe 100644
|
||||||
-
|
-
|
||||||
- def _build_libjq(self):
|
- def _build_libjq(self):
|
||||||
- self._build_lib(
|
- self._build_lib(
|
||||||
- source_url="https://github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz",
|
|
||||||
- tarball_path=jq_lib_tarball_path,
|
- tarball_path=jq_lib_tarball_path,
|
||||||
- lib_dir=jq_lib_dir,
|
- lib_dir=jq_lib_dir,
|
||||||
- commands=[
|
- commands=[
|
||||||
|
@ -83,9 +65,8 @@ index 663792c..3ebcabe 100644
|
||||||
- ["make"],
|
- ["make"],
|
||||||
- ])
|
- ])
|
||||||
-
|
-
|
||||||
- def _build_lib(self, source_url, tarball_path, lib_dir, commands):
|
- def _build_lib(self, tarball_path, lib_dir, commands):
|
||||||
- self._download_tarball(
|
- self._extract_tarball(
|
||||||
- source_url=source_url,
|
|
||||||
- tarball_path=tarball_path,
|
- tarball_path=tarball_path,
|
||||||
- lib_dir=lib_dir,
|
- lib_dir=lib_dir,
|
||||||
- )
|
- )
|
||||||
|
@ -101,16 +82,10 @@ index 663792c..3ebcabe 100644
|
||||||
- for command in commands:
|
- for command in commands:
|
||||||
- run_command(command)
|
- run_command(command)
|
||||||
-
|
-
|
||||||
- def _download_tarball(self, source_url, tarball_path, lib_dir):
|
- def _extract_tarball(self, tarball_path, lib_dir):
|
||||||
- if os.path.exists(tarball_path):
|
|
||||||
- os.unlink(tarball_path)
|
|
||||||
- print("Downloading {}".format(source_url))
|
|
||||||
- urlretrieve(source_url, tarball_path)
|
|
||||||
- print("Downloaded {}".format(source_url))
|
|
||||||
-
|
|
||||||
- if os.path.exists(lib_dir):
|
- if os.path.exists(lib_dir):
|
||||||
- shutil.rmtree(lib_dir)
|
- shutil.rmtree(lib_dir)
|
||||||
- tarfile.open(tarball_path, "r:gz").extractall(dependency_path("."))
|
- tarfile.open(tarball_path, "r:gz").extractall(_dep_build_path("."))
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
jq_extension = Extension(
|
jq_extension = Extension(
|
||||||
|
@ -126,19 +101,11 @@ index 663792c..3ebcabe 100644
|
||||||
)
|
)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
@@ -120,7 +26,6 @@ setup(
|
@@ -104,7 +25,6 @@ def _extract_tarball(self, tarball_path, lib_dir):
|
||||||
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
|
python_requires='>=3.5',
|
||||||
license='BSD 2-Clause',
|
license='BSD 2-Clause',
|
||||||
ext_modules = [jq_extension],
|
ext_modules = [jq_extension],
|
||||||
- cmdclass={"build_ext": jq_build_ext},
|
- cmdclass={"build_ext": jq_build_ext},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
@@ -137,4 +42,3 @@ setup(
|
|
||||||
'Programming Language :: Python :: 3.9',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
-
|
|
||||||
--
|
|
||||||
2.29.3
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue