nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

python3Packages.jq: 0.1.8 -> 1.0.2

(cherry picked from commit cf54ef99b63a38a99cee677ecf1daf32b95358e1)

authored by

William Kral and committed by
Jon
786a346d 1d6f2020

+67 -56
+3 -9
pkgs/development/python-modules/jq/default.nix
··· 1 - { buildPythonPackage, fetchPypi, lib, cython, jq }: 1 + { buildPythonPackage, fetchPypi, lib, jq }: 2 2 3 3 buildPythonPackage rec { 4 4 pname = "jq"; 5 - version = "0.1.8"; 5 + version = "1.0.2"; 6 6 7 7 src = fetchPypi { 8 8 inherit pname version; 9 - sha256 = "9b6bb376237133080185ab556ca2a724e8be5b31946eb2053d4a1f17ae9df9a8"; 9 + sha256 = "9fe6ce07bc8d209c385d8ba132a2971c69aef015103c46bea87a73a16c5ec147"; 10 10 }; 11 11 patches = [ ./jq-py-setup.patch ]; 12 - 13 - nativeBuildInputs = [ cython ]; 14 - 15 - preBuild = '' 16 - cython jq.pyx 17 - ''; 18 12 19 13 buildInputs = [ jq ]; 20 14
+64 -47
pkgs/development/python-modules/jq/jq-py-setup.patch
··· 1 - From 3f369cf8b9f7134d0792f6b141d39b5342a8274f Mon Sep 17 00:00:00 2001 2 - From: Benjamin Staffin <benley@gmail.com> 3 - Date: Mon, 14 Jan 2019 17:27:06 -0500 1 + From 968ddf2bd773e800e46737fced743bd00af9aa0d Mon Sep 17 00:00:00 2001 2 + From: William Kral <william.kral@gmail.com> 3 + Date: Tue, 8 Sep 2020 22:04:24 -0700 4 4 Subject: [PATCH] Vastly simplify setup.py for distro compatibility 5 5 6 6 --- 7 - setup.py | 81 +------------------------------------------------------- 8 - 1 file changed, 1 insertion(+), 80 deletions(-) 7 + setup.py | 101 ++----------------------------------------------------- 8 + 1 file changed, 2 insertions(+), 99 deletions(-) 9 9 10 10 diff --git a/setup.py b/setup.py 11 - index 77933f2..2b71e25 100644 11 + index cb63f60..87380ed 100644 12 12 --- a/setup.py 13 13 +++ b/setup.py 14 - @@ -1,10 +1,6 @@ 14 + @@ -1,114 +1,19 @@ 15 15 #!/usr/bin/env python 16 16 17 17 import os 18 - -import platform 19 18 -import subprocess 20 19 -import tarfile 21 20 -import shutil 21 + -import sysconfig 22 22 23 - try: 24 - import sysconfig 25 - @@ -14,88 +10,15 @@ except ImportError: 26 - 23 + -import requests 27 24 from setuptools import setup 28 - from distutils.extension import Extension 29 - -from distutils.command.build_ext import build_ext 25 + -from setuptools.command.build_ext import build_ext 26 + from setuptools.extension import Extension 27 + 28 + 29 + -def urlretrieve(source_url, destination_path): 30 + - response = requests.get(source_url, stream=True) 31 + - if response.status_code != 200: 32 + - raise Exception("status code was: {}".format(response.status_code)) 30 33 - 31 - -try: 32 - - from urllib import urlretrieve 33 - -except ImportError: 34 - - from urllib.request import urlretrieve 34 + - with open(destination_path, "wb") as fileobj: 35 + - for chunk in response.iter_content(chunk_size=128): 36 + - fileobj.write(chunk) 35 37 - 36 38 -def path_in_dir(relative_path): 37 39 - return os.path.abspath(os.path.join(os.path.dirname(__file__), relative_path)) 38 - 40 + - 41 + -def dependency_path(relative_path): 42 + - return os.path.join(path_in_dir("_deps"), relative_path) 43 + - 39 44 def read(fname): 40 45 return open(os.path.join(os.path.dirname(__file__), fname)).read() 41 46 42 47 43 - -jq_lib_tarball_path = path_in_dir("_jq-lib-1.5.tar.gz") 44 - -jq_lib_dir = path_in_dir("jq-jq-1.5") 48 + -jq_lib_tarball_path = dependency_path("jq-lib-1.6.tar.gz") 49 + -jq_lib_dir = dependency_path("jq-1.6") 45 50 - 46 - -oniguruma_lib_tarball_path = path_in_dir("_onig-5.9.6.tar.gz") 47 - -oniguruma_lib_build_dir = path_in_dir("onig-5.9.6") 48 - -oniguruma_lib_install_dir = path_in_dir("onig-install-5.9.6") 51 + -oniguruma_version = "6.9.4" 52 + -oniguruma_lib_tarball_path = dependency_path("onig-{}.tar.gz".format(oniguruma_version)) 53 + -oniguruma_lib_build_dir = dependency_path("onig-{}".format(oniguruma_version)) 54 + -oniguruma_lib_install_dir = dependency_path("onig-install-{}".format(oniguruma_version)) 49 55 - 50 56 -class jq_build_ext(build_ext): 51 57 - def run(self): 58 + - if not os.path.exists(dependency_path(".")): 59 + - os.makedirs(dependency_path(".")) 52 60 - self._build_oniguruma() 53 61 - self._build_libjq() 54 62 - build_ext.run(self) 55 - - 63 + - 56 64 - def _build_oniguruma(self): 57 65 - self._build_lib( 58 - - source_url="https://github.com/kkos/oniguruma/releases/download/v5.9.6/onig-5.9.6.tar.gz", 66 + - source_url="https://github.com/kkos/oniguruma/releases/download/v{0}/onig-{0}.tar.gz".format(oniguruma_version), 59 67 - tarball_path=oniguruma_lib_tarball_path, 60 68 - lib_dir=oniguruma_lib_build_dir, 61 69 - commands=[ ··· 71 63 - ["make"], 72 64 - ["make", "install"], 73 65 - ]) 74 - - 75 - - 66 + - 67 + - 76 68 - def _build_libjq(self): 77 69 - self._build_lib( 78 - - source_url="https://github.com/stedolan/jq/archive/jq-1.5.tar.gz", 70 + - source_url="https://github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz", 79 71 - tarball_path=jq_lib_tarball_path, 80 72 - lib_dir=jq_lib_dir, 81 73 - commands=[ ··· 83 75 - ["./configure", "CFLAGS=-fPIC", "--disable-maintainer-mode", "--with-oniguruma=" + oniguruma_lib_install_dir], 84 76 - ["make"], 85 77 - ]) 86 - - 78 + - 87 79 - def _build_lib(self, source_url, tarball_path, lib_dir, commands): 88 - - self._download_tarball(source_url, tarball_path) 80 + - self._download_tarball( 81 + - source_url=source_url, 82 + - tarball_path=tarball_path, 83 + - lib_dir=lib_dir, 84 + - ) 89 85 - 90 86 - macosx_deployment_target = sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET") 91 87 - if macosx_deployment_target: ··· 98 86 - def run_command(args): 99 87 - print("Executing: %s" % ' '.join(args)) 100 88 - subprocess.check_call(args, cwd=lib_dir) 101 - - 89 + - 102 90 - for command in commands: 103 91 - run_command(command) 104 - - 105 - - def _download_tarball(self, source_url, tarball_path): 92 + - 93 + - def _download_tarball(self, source_url, tarball_path, lib_dir): 106 94 - if os.path.exists(tarball_path): 107 95 - os.unlink(tarball_path) 96 + - print("Downloading {}".format(source_url)) 108 97 - urlretrieve(source_url, tarball_path) 109 - - 110 - - if os.path.exists(jq_lib_dir): 111 - - shutil.rmtree(jq_lib_dir) 112 - - tarfile.open(tarball_path, "r:gz").extractall(path_in_dir(".")) 98 + - print("Downloaded {}".format(source_url)) 99 + - 100 + - if os.path.exists(lib_dir): 101 + - shutil.rmtree(lib_dir) 102 + - tarfile.open(tarball_path, "r:gz").extractall(dependency_path(".")) 113 103 - 114 104 - 115 105 jq_extension = Extension( 116 106 "jq", 117 107 sources=["jq.c"], 118 - - include_dirs=[jq_lib_dir], 108 + - include_dirs=[os.path.join(jq_lib_dir, "src")], 109 + - extra_link_args=["-lm"], 119 110 - extra_objects=[ 120 111 - os.path.join(jq_lib_dir, ".libs/libjq.a"), 121 112 - os.path.join(oniguruma_lib_install_dir, "lib/libonig.a"), 122 113 - ], 123 - + libraries=["jq"], 114 + + libraries=["jq"] 124 115 ) 125 116 126 117 setup( 127 - @@ -107,7 +30,6 @@ setup( 128 - url='https://github.com/mwilliamson/jq.py', 118 + @@ -120,8 +25,7 @@ setup( 119 + url='http://github.com/mwilliamson/jq.py', 120 + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', 129 121 license='BSD 2-Clause', 130 - ext_modules = [jq_extension], 122 + - ext_modules = [jq_extension], 131 123 - cmdclass={"build_ext": jq_build_ext}, 124 + + ext_modules=[jq_extension], 132 125 classifiers=[ 133 - 'Development Status :: 4 - Beta', 126 + 'Development Status :: 5 - Production/Stable', 134 127 'Intended Audience :: Developers', 135 - @@ -123,4 +45,3 @@ setup( 136 - 'Programming Language :: Python :: 3.5', 128 + @@ -137,4 +41,3 @@ setup( 129 + 'Programming Language :: Python :: 3.8', 137 130 ], 138 131 ) 139 132 - 140 133 -- 141 - 2.19.2 134 + 2.28.0 142 135