diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python2-modules')
34 files changed, 1384 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python2-modules/attrs/default.nix b/nixpkgs/pkgs/development/python2-modules/attrs/default.nix new file mode 100644 index 000000000000..4b10f4203e8b --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/attrs/default.nix @@ -0,0 +1,45 @@ +{ lib +, callPackage +, buildPythonPackage +, fetchPypi +}: + +buildPythonPackage rec { + pname = "attrs"; + version = "21.4.0"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-YmuoI0IR25joad92IwoTfExAoS1yRFxF1fW3FvB24v0="; + }; + + outputs = [ + "out" + "testout" + ]; + + postInstall = '' + # Install tests as the tests output. + mkdir $testout + cp -R tests $testout/tests + ''; + + pythonImportsCheck = [ + "attr" + ]; + + # pytest depends on attrs, so we can't do this out-of-the-box. + # Instead, we do this as a passthru.tests test. + doCheck = false; + + passthru.tests = { + pytest = callPackage ./tests.nix { }; + }; + + meta = with lib; { + description = "Python attributes without boilerplate"; + homepage = "https://github.com/hynek/attrs"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/bootstrapped-pip/default.nix b/nixpkgs/pkgs/development/python2-modules/bootstrapped-pip/default.nix new file mode 100644 index 000000000000..2fc8b8b8d4b7 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/bootstrapped-pip/default.nix @@ -0,0 +1,66 @@ +{ lib, stdenv, python, makeWrapper, unzip +, pipInstallHook +, setuptoolsBuildHook +, wheel, pip, setuptools +}: + +stdenv.mkDerivation rec { + pname = "pip"; + inherit (pip) version; + name = "${python.libPrefix}-bootstrapped-${pname}-${version}"; + + srcs = [ wheel.src pip.src setuptools.src ]; + sourceRoot = "."; + + dontUseSetuptoolsBuild = true; + dontUsePipInstall = true; + + # Should be propagatedNativeBuildInputs + propagatedBuildInputs = [ + # Override to remove dependencies to prevent infinite recursion. + (pipInstallHook.override{pip=null;}) + (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) + ]; + + postPatch = '' + mkdir -p $out/bin + ''; + + nativeBuildInputs = [ makeWrapper unzip ]; + buildInputs = [ python ]; + + dontBuild = true; + + installPhase = lib.optionalString (!stdenv.hostPlatform.isWindows) '' + export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 + '' + '' + # Give folders a known name + mv pip* pip + mv setuptools* setuptools + mv wheel* wheel + # Set up PYTHONPATH. The above folders need to be on PYTHONPATH + # $out is where we are installing to and takes precedence + export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$PYTHONPATH" + + echo "Building setuptools wheel..." + pushd setuptools + ${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . + popd + + echo "Building wheel wheel..." + pushd wheel + ${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . + popd + + echo "Building pip wheel..." + pushd pip + ${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . + popd + ''; + + meta = { + description = "Version of pip used for bootstrapping"; + license = lib.unique (pip.meta.license ++ setuptools.meta.license ++ wheel.meta.license); + homepage = pip.meta.homepage; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/cffi/default.nix b/nixpkgs/pkgs/development/python2-modules/cffi/default.nix new file mode 100644 index 000000000000..adeda6e90d22 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/cffi/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv, cffi }: + +if cffi == null then null else cffi.overridePythonAttrs { + disabledTests = lib.optionals stdenv.isDarwin [ + # cannot load library 'c' + "test_FILE" + "test_FILE_object" + "test_FILE_only_for_FILE_arg" + "test_load_and_call_function" + "test_load_library" + + # cannot load library 'dl' + "test_dlopen_handle" + + # cannot load library 'm' + "test_dir_on_dlopen_lib" + "test_dlclose" + "test_dlopen" + "test_dlopen_constant" + "test_dlopen_flags" + "test_function_typedef" + "test_line_continuation_in_defines" + "test_missing_function" + "test_remove_comments" + "test_remove_line_continuation_comments" + "test_simple" + "test_sin" + "test_sinf" + "test_stdcall_only_on_windows" + "test_wraps_from_stdlib" + + # MemoryError + "test_callback_as_function_argument" + "test_callback_crash" + "test_callback_decorator" + "test_callback_large_struct" + "test_callback_returning_void" + "test_cast_functionptr_and_int" + "test_function_pointer" + "test_functionptr_intptr_return" + "test_functionptr_simple" + "test_functionptr_void_return" + "test_functionptr_voidptr_return" + ]; +} diff --git a/nixpkgs/pkgs/development/python2-modules/configparser/default.nix b/nixpkgs/pkgs/development/python2-modules/configparser/default.nix new file mode 100644 index 000000000000..0f3b6e0b4912 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/configparser/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, buildPythonPackage, fetchPypi, setuptools-scm }: + +buildPythonPackage rec { + pname = "configparser"; + version = "4.0.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df"; + }; + + # No tests available + doCheck = false; + + nativeBuildInputs = [ setuptools-scm ]; + + preConfigure = '' + export LC_ALL=${if stdenv.isDarwin then "en_US" else "C"}.UTF-8 + ''; + + meta = with lib; { + description = "Updated configparser from Python 3.7 for Python 2.6+."; + license = licenses.mit; + homepage = "https://github.com/jaraco/configparser"; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/contextlib2/default.nix b/nixpkgs/pkgs/development/python2-modules/contextlib2/default.nix new file mode 100644 index 000000000000..063039448fea --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/contextlib2/default.nix @@ -0,0 +1,23 @@ +{ lib +, buildPythonPackage +, fetchPypi +}: + +buildPythonPackage rec { + pname = "contextlib2"; + version = "0.6.0.post1"; + + src = fetchPypi { + inherit pname version; + sha256 = "01f490098c18b19d2bd5bb5dc445b2054d2fa97f09a4280ba2c5f3c394c8162e"; + }; + + # requires unittest2, which has been removed + doCheck = false; + + meta = { + description = "Backports and enhancements for the contextlib module"; + homepage = "https://contextlib2.readthedocs.org/"; + license = lib.licenses.psfl; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/coverage/default.nix b/nixpkgs/pkgs/development/python2-modules/coverage/default.nix new file mode 100644 index 000000000000..94da2f4c7b43 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/coverage/default.nix @@ -0,0 +1,25 @@ +{ lib +, buildPythonPackage +, fetchPypi +, mock +}: + +buildPythonPackage rec { + pname = "coverage"; + version = "5.5"; + + src = fetchPypi { + inherit pname version; + sha256 = "ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"; + }; + + # No tests in archive + doCheck = false; + nativeCheckInputs = [ mock ]; + + meta = { + description = "Code coverage measurement for python"; + homepage = "https://coverage.readthedocs.io/"; + license = lib.licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/enum/default.nix b/nixpkgs/pkgs/development/python2-modules/enum/default.nix new file mode 100644 index 000000000000..db827601d5de --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/enum/default.nix @@ -0,0 +1,26 @@ +{ lib +, buildPythonPackage +, fetchPypi +, isPy3k +, isPyPy +}: + +buildPythonPackage rec { + pname = "enum"; + version = "0.4.7"; + disabled = isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "001iq0yqs9f5bslvl793bhkcs71k5km9kv8yrj5h0lfsgrcg6z4c"; + }; + + doCheck = !isPyPy; + + meta = with lib; { + homepage = "https://pypi.python.org/pypi/enum/"; + description = "Robust enumerated type support in Python"; + license = licenses.gpl2; + }; + +} diff --git a/nixpkgs/pkgs/development/python2-modules/filelock/default.nix b/nixpkgs/pkgs/development/python2-modules/filelock/default.nix new file mode 100644 index 000000000000..401fdf582ffb --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/filelock/default.nix @@ -0,0 +1,22 @@ +{ lib, buildPythonPackage, fetchPypi, setuptools-scm }: + +buildPythonPackage rec { + pname = "filelock"; + version = "3.2.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "1qry67zv2pmz8px6wdfbjqv75nmryy2ac7asqgs6q6db2722kpcw"; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + meta = with lib; { + homepage = "https://github.com/benediktschmitt/py-filelock"; + description = "A platform independent file lock for Python"; + license = licenses.unlicense; + maintainers = with maintainers; [ henkkalkwater ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/futures/default.nix b/nixpkgs/pkgs/development/python2-modules/futures/default.nix new file mode 100644 index 000000000000..bc19a31927af --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/futures/default.nix @@ -0,0 +1,27 @@ +{ lib, buildPythonPackage, fetchPypi, isPy3k, python, stdenv }: + +buildPythonPackage rec { + pname = "futures"; + version = "3.3.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "7e033af76a5e35f58e56da7a91e687706faf4e7bdfb2cbc3f2cca6b9bcda9794"; + }; + + # This module is for backporting functionality to Python 2.x, it's builtin in py3k + disabled = isPy3k; + + checkPhase = '' + ${python.interpreter} test_futures.py + ''; + + doCheck = !stdenv.isDarwin; + + meta = with lib; { + description = "Backport of the concurrent.futures package from Python 3.2"; + homepage = "https://github.com/agronholm/pythonfutures"; + license = licenses.bsd2; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/hypothesis/default.nix b/nixpkgs/pkgs/development/python2-modules/hypothesis/default.nix new file mode 100644 index 000000000000..f1eb403d8109 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/hypothesis/default.nix @@ -0,0 +1,45 @@ +{ lib, buildPythonPackage, fetchFromGitHub +, isPy3k, attrs, coverage, enum34, pexpect +, doCheck ? true, pytest, pytest-xdist, flaky, mock +, sortedcontainers +}: +buildPythonPackage rec { + # https://hypothesis.readthedocs.org/en/latest/packaging.html + + # Hypothesis has optional dependencies on the following libraries + # pytz fake_factory django numpy pytest + # If you need these, you can just add them to your environment. + + version = "4.57.1"; + pname = "hypothesis"; + + # Use github tarballs that includes tests + src = fetchFromGitHub { + owner = "HypothesisWorks"; + repo = "hypothesis-python"; + rev = "hypothesis-python-${version}"; + sha256 = "1qcpcrk6892hzyjsdr581pw6i4fj9035nv89mcjrcrzcmycdlfds"; + }; + + postUnpack = "sourceRoot=$sourceRoot/hypothesis-python"; + + propagatedBuildInputs = [ + attrs + coverage + sortedcontainers + ] ++ lib.optional (!isPy3k) enum34; + + nativeCheckInputs = [ pytest pytest-xdist flaky mock pexpect ]; + inherit doCheck; + + checkPhase = '' + rm tox.ini # This file changes how py.test runs and breaks it + py.test tests/cover + ''; + + meta = with lib; { + description = "A Python library for property based testing"; + homepage = "https://github.com/HypothesisWorks/hypothesis"; + license = licenses.mpl20; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/importlib-metadata/default.nix b/nixpkgs/pkgs/development/python2-modules/importlib-metadata/default.nix new file mode 100644 index 000000000000..f50b2c07c1da --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/importlib-metadata/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, zipp +, pathlib2 +, contextlib2 +, configparser +, isPy3k +}: + +buildPythonPackage rec { + pname = "importlib-metadata"; + version = "2.1.1"; + + src = fetchPypi { + pname = "importlib_metadata"; + inherit version; + sha256 = "1pdmsmwagimn0lsl4x7sg3skcr2fvzqpv2pjd1rh7yrm5gzrxpmq"; + }; + + nativeBuildInputs = [ setuptools-scm ]; + + propagatedBuildInputs = [ zipp ] + ++ lib.optionals (!isPy3k) [ pathlib2 contextlib2 configparser ]; + + # Cyclic dependencies + doCheck = false; + + pythonImportsCheck = [ "importlib_metadata" ]; + + meta = with lib; { + description = "Read metadata from Python packages"; + homepage = "https://importlib-metadata.readthedocs.io/"; + license = licenses.asl20; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/jinja2/default.nix b/nixpkgs/pkgs/development/python2-modules/jinja2/default.nix new file mode 100644 index 000000000000..3b593338763f --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/jinja2/default.nix @@ -0,0 +1,42 @@ +{ lib, stdenv +, buildPythonPackage +, isPy3k +, fetchPypi +, pytest +, markupsafe +, setuptools +}: + +buildPythonPackage rec { + pname = "Jinja2"; + version = "2.11.3"; + + src = fetchPypi { + inherit pname version; + sha256 = "a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"; + }; + + nativeCheckInputs = [ pytest ]; + propagatedBuildInputs = [ markupsafe setuptools ]; + + # Multiple tests run out of stack space on 32bit systems with python2. + # See https://github.com/pallets/jinja/issues/1158 + # warnings are no longer being filtered correctly for python2 + doCheck = !stdenv.is32bit && isPy3k; + + checkPhase = '' + pytest -v tests -W ignore::DeprecationWarning + ''; + + meta = with lib; { + homepage = "http://jinja.pocoo.org/"; + description = "Stand-alone template engine"; + license = licenses.bsd3; + longDescription = '' + Jinja2 is a template engine written in pure Python. It provides a + Django inspired non-XML syntax but supports inline expressions and + an optional sandboxed environment. + ''; + maintainers = with maintainers; [ pierron ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/markupsafe/default.nix b/nixpkgs/pkgs/development/python2-modules/markupsafe/default.nix new file mode 100644 index 000000000000..ae0878c7a972 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/markupsafe/default.nix @@ -0,0 +1,22 @@ +{ lib +, buildPythonPackage +, fetchPypi +}: + +buildPythonPackage rec { + pname = "MarkupSafe"; + version = "1.1.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"; + }; + + meta = with lib; { + description = "Implements a XML/HTML/XHTML Markup safe string"; + homepage = "http://dev.pocoo.org"; + license = licenses.bsd3; + maintainers = with maintainers; [ domenkozar ]; + }; + +} diff --git a/nixpkgs/pkgs/development/python2-modules/mock/default.nix b/nixpkgs/pkgs/development/python2-modules/mock/default.nix new file mode 100644 index 000000000000..a343acfffaa1 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/mock/default.nix @@ -0,0 +1,41 @@ +{ lib +, buildPythonPackage +, fetchPypi +, isPy27 +, funcsigs +, six +, pbr +, unittestCheckHook +, pytest +}: + +buildPythonPackage rec { + pname = "mock"; + version = "3.0.5"; + + src = fetchPypi { + inherit pname version; + sha256 = "83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3"; + }; + + propagatedBuildInputs = [ six pbr ] ++ lib.optionals isPy27 [ funcsigs ]; + + # On PyPy for Python 2.7 in particular, Mock's tests have a known failure. + # Mock upstream has a decoration to disable the failing test and make + # everything pass, but it is not yet released. The commit: + # https://github.com/testing-cabal/mock/commit/73bfd51b7185#diff-354f30a63fb0907d4ad57269548329e3L12 + #doCheck = !(python.isPyPy && python.isPy27); + doCheck = false; # Infinite recursion pytest + + nativeCheckInputs = [ + unittestCheckHook + pytest + ]; + + meta = with lib; { + description = "Mock objects for Python"; + homepage = "http://python-mock.sourceforge.net/"; + license = licenses.bsd2; + }; + +} diff --git a/nixpkgs/pkgs/development/python2-modules/more-itertools/default.nix b/nixpkgs/pkgs/development/python2-modules/more-itertools/default.nix new file mode 100644 index 000000000000..615b1d00d204 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/more-itertools/default.nix @@ -0,0 +1,31 @@ +{ lib +, buildPythonPackage +, fetchPypi +, nose +, six +, stdenv +}: + + +buildPythonPackage rec { + pname = "more-itertools"; + version = "5.0.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4"; + }; + + nativeCheckInputs = [ nose ]; + propagatedBuildInputs = [ six ]; + + # iterable = range(10 ** 10) # Is efficiently reversible + # OverflowError: Python int too large to convert to C long + doCheck = !stdenv.hostPlatform.is32bit; + + meta = { + homepage = "https://more-itertools.readthedocs.org"; + description = "Expansion of the itertools module"; + license = lib.licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/packaging/default.nix b/nixpkgs/pkgs/development/python2-modules/packaging/default.nix new file mode 100644 index 000000000000..61f0ed3a7303 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/packaging/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pyparsing +, six +, pytestCheckHook +, pretend +}: + +# We keep 20.4 because it uses setuptools instead of flit-core +# which requires Python 3 to build a universal wheel. + +buildPythonPackage rec { + pname = "packaging"; + version = "20.4"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + sha256 = "4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"; + }; + + propagatedBuildInputs = [ pyparsing six ]; + + nativeCheckInputs = [ + pytestCheckHook + pretend + ]; + + # Prevent circular dependency + doCheck = false; + + meta = with lib; { + description = "Core utilities for Python packages"; + homepage = "https://github.com/pypa/packaging"; + license = [ licenses.bsd2 licenses.asl20 ]; + maintainers = with maintainers; [ bennofs ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pip/default.nix b/nixpkgs/pkgs/development/python2-modules/pip/default.nix new file mode 100644 index 000000000000..ba78377f5943 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pip/default.nix @@ -0,0 +1,41 @@ +{ lib +, buildPythonPackage +, bootstrapped-pip +, fetchFromGitHub +, mock +, scripttest +, virtualenv +, pretend +, pytest +}: + +buildPythonPackage rec { + pname = "pip"; + version = "20.3.4"; + format = "other"; + + src = fetchFromGitHub { + owner = "pypa"; + repo = pname; + rev = version; + sha256 = "0hkhs9yc1cjdj1gn9wkycd3sy65c05q8k8rhqgsm5jbpksfssiwn"; + name = "${pname}-${version}-source"; + }; + + nativeBuildInputs = [ bootstrapped-pip ]; + + # pip detects that we already have bootstrapped_pip "installed", so we need + # to force it a little. + pipInstallFlags = [ "--ignore-installed" ]; + + nativeCheckInputs = [ mock scripttest virtualenv pretend pytest ]; + # Pip wants pytest, but tests are not distributed + doCheck = false; + + meta = { + description = "The PyPA recommended tool for installing Python packages"; + license = with lib.licenses; [ mit ]; + homepage = "https://pip.pypa.io/"; + priority = 10; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pluggy/default.nix b/nixpkgs/pkgs/development/python2-modules/pluggy/default.nix new file mode 100644 index 000000000000..30fa2e1945b2 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pluggy/default.nix @@ -0,0 +1,34 @@ +{ buildPythonPackage +, lib +, fetchPypi +, setuptools-scm +, importlib-metadata +}: + +buildPythonPackage rec { + pname = "pluggy"; + version = "0.13.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"; + }; + + checkPhase = '' + py.test + ''; + + # To prevent infinite recursion with pytest + doCheck = false; + + nativeBuildInputs = [ setuptools-scm ]; + + propagatedBuildInputs = [ importlib-metadata ]; + + meta = { + description = "Plugin and hook calling mechanisms for Python"; + homepage = "https://github.com/pytest-dev/pluggy"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pycairo/default.nix b/nixpkgs/pkgs/development/python2-modules/pycairo/default.nix new file mode 100644 index 000000000000..eefc69a3323f --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pycairo/default.nix @@ -0,0 +1,54 @@ +{ lib +, fetchFromGitHub +, meson +, ninja +, buildPythonPackage +, pytest +, pkg-config +, cairo +, python +}: + +buildPythonPackage rec { + pname = "pycairo"; + version = "1.18.2"; + + format = "other"; + + src = fetchFromGitHub { + owner = "pygobject"; + repo = "pycairo"; + rev = "v${version}"; + sha256 = "142145a2whvlk92jijrbf3i2bqrzmspwpysj0bfypw0krzi0aa6j"; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + cairo + ]; + + # HACK: Don't use the pytestCheckHook because PYTHONPATH + # will be added by the Python setuptook breaking meson. + checkPhase = '' + ${pytest}/bin/pytest + ''; + + mesonFlags = [ + # This is only used for figuring out what version of Python is in + # use, and related stuff like figuring out what the install prefix + # should be, but it does need to be able to execute Python code. + "-Dpython=${python.pythonForBuild.interpreter}" + ]; + + meta = with lib; { + description = "Python 2 bindings for cairo"; + homepage = "https://pycairo.readthedocs.io/"; + license = with licenses; [ lgpl21Only mpl11 ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pygobject/default.nix b/nixpkgs/pkgs/development/python2-modules/pygobject/default.nix new file mode 100644 index 000000000000..2a09002976b2 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pygobject/default.nix @@ -0,0 +1,48 @@ +{ lib, stdenv, fetchurl, fetchpatch, python, buildPythonPackage, pkg-config, glib, isPy3k, pythonAtLeast }: + +buildPythonPackage rec { + pname = "pygobject"; + version = "2.28.7"; + format = "other"; + disabled = pythonAtLeast "3.9"; + + src = fetchurl { + url = "mirror://gnome/sources/pygobject/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; + sha256 = "0nkam61rsn7y3wik3vw46wk5q2cjfh2iph57hl9m39rc8jijb7dv"; + }; + + outputs = [ "out" "devdoc" ]; + + patches = lib.optionals stdenv.isDarwin [ + ./pygobject-2.0-fix-darwin.patch + (fetchpatch { + url = "https://github.com/macports/macports-ports/raw/f2975d5bbbc2459c661905c5a850cc661fa32f55/python/py-gobject/files/py-gobject-dynamic_lookup-11.patch"; + sha256 = "sha256-mtlyu+La3+iC5iQAmVJzDA5E35XGaRQy/EKXzvrWRCg="; + extraPrefix = ""; + }) + ]; + + configureFlags = [ "--disable-introspection" ]; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ glib ]; + + # in a "normal" setup, pygobject and pygtk are installed into the + # same site-packages: we need a pth file for both. pygtk.py would be + # used to select a specific version, in our setup it should have no + # effect, but we leave it in case somebody expects and calls it. + postInstall = lib.optionalString (!isPy3k) '' + mv $out/${python.sitePackages}/{pygtk.pth,${pname}-${version}.pth} + + # Prevent wrapping of codegen files as these are meant to be + # executed by the python program + chmod a-x $out/share/pygobject/*/codegen/*.py + ''; + + meta = with lib; { + homepage = "https://pygobject.readthedocs.io/"; + description = "Python bindings for GLib"; + license = licenses.gpl2; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pygobject/pygobject-2.0-fix-darwin.patch b/nixpkgs/pkgs/development/python2-modules/pygobject/pygobject-2.0-fix-darwin.patch new file mode 100644 index 000000000000..7fef05262f4d --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pygobject/pygobject-2.0-fix-darwin.patch @@ -0,0 +1,88 @@ +--- a/gio/unix-types.defs ++++ b/gio/unix-types.defs +@@ -7,18 +7,6 @@ + (gtype-id "G_TYPE_UNIX_CONNECTION") + ) + +-(define-object DesktopAppInfo +- (docstring +- "DesktopAppInfo(desktop_id) -> gio.unix.DesktopAppInfo\n\n" +- "gio.Unix.DesktopAppInfo is an implementation of gio.AppInfo\n" +- "based on desktop files." +- ) +- (in-module "giounix") +- (parent "GObject") +- (c-name "GDesktopAppInfo") +- (gtype-id "G_TYPE_DESKTOP_APP_INFO") +-) +- + (define-object FDMessage + (in-module "giounix") + (parent "GSocketControlMessage") +--- a/gio/unix.defs ++++ b/gio/unix.defs +@@ -32,54 +32,6 @@ + + + +-;; From gdesktopappinfo.h +- +-(define-function desktop_app_info_get_type +- (c-name "g_desktop_app_info_get_type") +- (return-type "GType") +-) +- +-(define-function desktop_app_info_new_from_filename +- (c-name "g_desktop_app_info_new_from_filename") +- (return-type "GDesktopAppInfo*") +- (parameters +- '("const-char*" "filename") +- ) +-) +- +-(define-function g_desktop_app_info_new_from_keyfile +- (c-name "g_desktop_app_info_new_from_keyfile") +- (return-type "GDesktopAppInfo*") +- (parameters +- '("GKeyFile*" "key_file") +- ) +-) +- +-(define-function desktop_app_info_new +- (c-name "g_desktop_app_info_new") +- (is-constructor-of "GDesktopAppInfo") +- (return-type "GDesktopAppInfo*") +- (parameters +- '("const-char*" "desktop_id") +- ) +-) +- +-(define-method get_is_hidden +- (of-object "GDesktopAppInfo") +- (c-name "g_desktop_app_info_get_is_hidden") +- (return-type "gboolean") +-) +- +-(define-function desktop_app_info_set_desktop_env +- (c-name "g_desktop_app_info_set_desktop_env") +- (return-type "none") +- (parameters +- '("const-char*" "desktop_env") +- ) +-) +- +- +- + ;; From gunixfdmessage.h + + (define-function g_unix_fd_message_get_type +--- a/gio/unix.override ++++ b/gio/unix.override +@@ -24,7 +24,6 @@ + #define NO_IMPORT_PYGOBJECT + #include <pygobject.h> + #include <gio/gio.h> +-#include <gio/gdesktopappinfo.h> + #include <gio/gunixinputstream.h> + #include <gio/gunixmounts.h> + #include <gio/gunixoutputstream.h> diff --git a/nixpkgs/pkgs/development/python2-modules/pygtk/default.nix b/nixpkgs/pkgs/development/python2-modules/pygtk/default.nix new file mode 100644 index 000000000000..c3960dd5309d --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pygtk/default.nix @@ -0,0 +1,77 @@ +{ lib, stdenv, fetchurl, fetchpatch, python, pkg-config, gtk2, pygobject2, pycairo, pango +, buildPythonPackage, isPy3k }: + +buildPythonPackage rec { + pname = "pygtk"; + outputs = [ "out" "dev" ]; + version = "2.24.0"; + format = "other"; + + disabled = isPy3k; + + src = fetchurl { + url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2"; + sha256 = "04k942gn8vl95kwf0qskkv6npclfm31d78ljkrkgyqxxcni1w76d"; + }; + + patches = [ + # https://bugzilla.gnome.org/show_bug.cgi?id=660216 - fixes some memory leaks + (fetchpatch { + url = "https://gitlab.gnome.org/Archive/pygtk/commit/eca72baa5616fbe4dbebea43c7e5940847dc5ab8.diff"; + sha256 = "031px4w5cshcx1sns430sdbr2i007b9zyb2carb3z65nzr77dpdd"; + }) + (fetchpatch { + url = "https://gitlab.gnome.org/Archive/pygtk/commit/4aaa48eb80c6802aec6d03e5695d2a0ff20e0fc2.patch"; + sha256 = "0z8cg7nr3qki8gg8alasdzzyxcihfjlxn518glq5ajglk3q5pzsn"; + }) + ]; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + pango + ]; + + propagatedBuildInputs = [ gtk2 pygobject2 pycairo ]; + + configurePhase = "configurePhase"; + + buildPhase = "buildPhase"; + + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-ObjC" + + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -lpython2.7"; + + installPhase = "installPhase"; + + checkPhase = + '' + sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \ + tests/common.py + sed -i -e "s/, glade$//" \ + -e "s/.*testGlade.*//" \ + -e "s/.*(glade.*//" \ + tests/test_api.py + '' + '' + sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \ + -e "s/sys.path.insert(0, buildDir)//" \ + tests/common.py + make check + ''; + # XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'> + # The check phase was not executed in the previous + # non-buildPythonPackage setup - not sure why not. + doCheck = false; + + postInstall = '' + rm $out/bin/pygtk-codegen-2.0 + ln -s ${pygobject2}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0 + ln -s ${pygobject2}/lib/${python.libPrefix}/site-packages/pygobject-${pygobject2.version}.pth \ + $out/lib/${python.libPrefix}/site-packages/${pname}-${version}.pth + ''; + + meta = with lib; { + description = "GTK 2 Python bindings"; + homepage = "https://gitlab.gnome.org/Archive/pygtk"; + platforms = platforms.all; + license = with licenses; [ lgpl21Plus ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pyparsing/default.nix b/nixpkgs/pkgs/development/python2-modules/pyparsing/default.nix new file mode 100644 index 000000000000..5b61dc0c85b5 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pyparsing/default.nix @@ -0,0 +1,45 @@ +{ buildPythonPackage +, fetchFromGitHub +, lib + +# since this is a dependency of pytest, we need to avoid +# circular dependencies +, jinja2 +, railroad-diagrams +}: + +let + pyparsing = buildPythonPackage rec { + pname = "pyparsing"; + version = "2.4.7"; + + src = fetchFromGitHub { + owner = "pyparsing"; + repo = pname; + rev = "pyparsing_${version}"; + sha256 = "14pfy80q2flgzjcx8jkracvnxxnr59kjzp3kdm5nh232gk1v6g6h"; + }; + + # circular dependencies if enabled by default + doCheck = false; + nativeCheckInputs = [ + jinja2 + railroad-diagrams + ]; + + checkPhase = '' + python -m unittest + ''; + + passthru.tests = { + check = pyparsing.overridePythonAttrs (_: { doCheck = true; }); + }; + + meta = with lib; { + homepage = "https://github.com/pyparsing/pyparsing"; + description = "An alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions"; + license = licenses.mit; + }; + }; +in + pyparsing diff --git a/nixpkgs/pkgs/development/python2-modules/pytest-xdist/default.nix b/nixpkgs/pkgs/development/python2-modules/pytest-xdist/default.nix new file mode 100644 index 000000000000..5da424a0c302 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pytest-xdist/default.nix @@ -0,0 +1,36 @@ +{ lib, fetchPypi, buildPythonPackage, execnet, pytest +, setuptools-scm, pytest-forked, filelock, psutil, six, isPy3k }: + +buildPythonPackage rec { + pname = "pytest-xdist"; + version = "1.34.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "1vh4ps32lp5ignch5adbl3pgchvigdfmrl6qpmhxih54wa1qw3il"; + }; + + nativeBuildInputs = [ setuptools-scm pytest ]; + nativeCheckInputs = [ pytest filelock ]; + propagatedBuildInputs = [ execnet pytest-forked psutil six ]; + + # Encountered a memory leak + # https://github.com/pytest-dev/pytest-xdist/issues/462 + doCheck = !isPy3k; + + checkPhase = '' + # Excluded tests access file system + py.test testing -k "not test_distribution_rsyncdirs_example \ + and not test_rsync_popen_with_path \ + and not test_popen_rsync_subdir \ + and not test_init_rsync_roots \ + and not test_rsyncignore" + ''; + + meta = with lib; { + description = "py.test xdist plugin for distributed testing and loop-on-failing modes"; + homepage = "https://github.com/pytest-dev/pytest-xdist"; + license = licenses.mit; + maintainers = with maintainers; [ dotlambda ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/pytest/default.nix b/nixpkgs/pkgs/development/python2-modules/pytest/default.nix new file mode 100644 index 000000000000..0edfd3039112 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/pytest/default.nix @@ -0,0 +1,68 @@ +{ lib, buildPythonPackage, pythonOlder, fetchPypi, attrs, hypothesis, py +, setuptools-scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools +, atomicwrites, mock, writeText, pathlib2, wcwidth, packaging, isPyPy +}: +buildPythonPackage rec { + version = "4.6.11"; + pname = "pytest"; + + src = fetchPypi { + inherit pname version; + sha256 = "50fa82392f2120cc3ec2ca0a75ee615be4c479e66669789771f1758332be4353"; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace "pluggy>=0.12,<1.0" "pluggy>=0.12,<2.0" + ''; + + nativeCheckInputs = [ hypothesis mock ]; + buildInputs = [ setuptools-scm ]; + propagatedBuildInputs = [ attrs py setuptools six pluggy more-itertools atomicwrites wcwidth packaging ] + ++ lib.optionals (!isPy3k) [ funcsigs ] + ++ lib.optionals (pythonOlder "3.6") [ pathlib2 ]; + + doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460 + checkPhase = '' + runHook preCheck + + # don't test bash builtins + rm testing/test_argcomplete.py + + # determinism - this test writes non deterministic bytecode + rm -rf testing/test_assertrewrite.py + + PYTHONDONTWRITEBYTECODE=1 $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths" + runHook postCheck + ''; + + # Remove .pytest_cache when using py.test in a Nix build + setupHook = writeText "pytest-hook" '' + pytestcachePhase() { + find $out -name .pytest_cache -type d -exec rm -rf {} + + } + + preDistPhases+=" pytestcachePhase" + + # pytest generates it's own bytecode files to improve assertion messages. + # These files similar to cpython's bytecode files but are never laoded + # by python interpreter directly. We remove them for a few reasons: + # - files are non-deterministic: https://github.com/NixOS/nixpkgs/issues/139292 + # (file headers are generatedt by pytest directly and contain timestamps) + # - files are not needed after tests are finished + pytestRemoveBytecodePhase () { + # suffix is defined at: + # https://github.com/pytest-dev/pytest/blob/4.6.11/src/_pytest/assertion/rewrite.py#L32-L47 + find $out -name "*-PYTEST.py[co]" -delete + } + preDistPhases+=" pytestRemoveBytecodePhase" + ''; + + meta = with lib; { + homepage = "https://docs.pytest.org"; + description = "Framework for writing tests"; + maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ]; + license = licenses.mit; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/scandir/add-aarch64-darwin-dirent.patch b/nixpkgs/pkgs/development/python2-modules/scandir/add-aarch64-darwin-dirent.patch new file mode 100644 index 000000000000..1b35a0b950ce --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/scandir/add-aarch64-darwin-dirent.patch @@ -0,0 +1,28 @@ +diff --git a/scandir.py b/scandir.py +index 3f602fb..40af3e5 100644 +--- a/scandir.py ++++ b/scandir.py +@@ -23,6 +23,7 @@ from os import listdir, lstat, stat, strerror + from os.path import join, islink + from stat import S_IFDIR, S_IFLNK, S_IFREG + import collections ++import platform + import sys + + try: +@@ -432,6 +433,15 @@ elif sys.platform.startswith(('linux', 'darwin', 'sunos5')) or 'bsd' in sys.plat + ('__d_padding', ctypes.c_uint8 * 4), + ('d_name', ctypes.c_char * 256), + ) ++ elif 'darwin' in sys.platform and 'arm64' in platform.machine(): ++ _fields_ = ( ++ ('d_ino', ctypes.c_uint64), ++ ('d_off', ctypes.c_uint64), ++ ('d_reclen', ctypes.c_uint16), ++ ('d_namlen', ctypes.c_uint16), ++ ('d_type', ctypes.c_uint8), ++ ('d_name', ctypes.c_char * 1024), ++ ) + else: + _fields_ = ( + ('d_ino', ctypes.c_uint32), # must be uint32, not ulong diff --git a/nixpkgs/pkgs/development/python2-modules/scandir/default.nix b/nixpkgs/pkgs/development/python2-modules/scandir/default.nix new file mode 100644 index 000000000000..e712cca8348d --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/scandir/default.nix @@ -0,0 +1,24 @@ +{ lib, python, buildPythonPackage, fetchPypi }: + +buildPythonPackage rec { + pname = "scandir"; + version = "1.10.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "1bkqwmf056pkchf05ywbnf659wqlp6lljcdb0y88wr9f0vv32ijd"; + }; + + patches = [ + ./add-aarch64-darwin-dirent.patch + ]; + + checkPhase = "${python.interpreter} test/run_tests.py"; + + meta = with lib; { + description = "A better directory iterator and faster os.walk()"; + homepage = "https://github.com/benhoyt/scandir"; + license = licenses.gpl3; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/setuptools-scm/default.nix b/nixpkgs/pkgs/development/python2-modules/setuptools-scm/default.nix new file mode 100644 index 000000000000..4cf6f16fedfb --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/setuptools-scm/default.nix @@ -0,0 +1,24 @@ +{ lib, buildPythonPackage, fetchPypi, toml }: + +buildPythonPackage rec { + pname = "setuptools_scm"; + version = "5.0.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-g6DO3TRJ45RjB4EaTHudicS1/UZKL7XuzNCluxWK5cg="; + }; + + propagatedBuildInputs = [ toml ]; + + # Requires pytest, circular dependency + doCheck = false; + pythonImportsCheck = [ "setuptools_scm" ]; + + meta = with lib; { + homepage = "https://github.com/pypa/setuptools_scm/"; + description = "Handles managing your python package versions in scm metadata"; + license = licenses.mit; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/setuptools/default.nix b/nixpkgs/pkgs/development/python2-modules/setuptools/default.nix new file mode 100644 index 000000000000..ca70a1061512 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/setuptools/default.nix @@ -0,0 +1,80 @@ +{ stdenv +, buildPythonPackage +, fetchFromGitHub +, python +, bootstrapped-pip +, lib +, pipInstallHook +, setuptoolsBuildHook +}: + +let + pname = "setuptools"; + version = "44.0.0"; + + # Create an sdist of setuptools + sdist = stdenv.mkDerivation rec { + name = "${pname}-${version}-sdist.tar.gz"; + + src = fetchFromGitHub { + owner = "pypa"; + repo = pname; + rev = "v${version}"; + sha256 = "0z3q0qinyp1rmnxkw3y5f6nbsxhqlfq5k7skfrqa6ymb3zr009y1"; + name = "${pname}-${version}-source"; + }; + + patches = [ + ./tag-date.patch + ]; + + buildPhase = '' + ${python.pythonForBuild.interpreter} bootstrap.py + ${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar + + # Here we untar the sdist and retar it in order to control the timestamps + # of all the files included + tar -xzf dist/${pname}-${version}.post0.tar.gz -C dist/ + tar -czf dist/${name} -C dist/ --mtime="@$SOURCE_DATE_EPOCH" ${pname}-${version}.post0 + ''; + + installPhase = '' + echo "Moving sdist..." + mv dist/${name} $out + ''; + }; +in buildPythonPackage rec { + inherit pname version; + # Because of bootstrapping we don't use the setuptoolsBuildHook that comes with format="setuptools" directly. + # Instead, we override it to remove setuptools to avoid a circular dependency. + # The same is done for pip and the pipInstallHook. + format = "other"; + + src = sdist; + + nativeBuildInputs = [ + bootstrapped-pip + (pipInstallHook.override{pip=null;}) + (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) + ]; + + preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) '' + export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 + ''; + + pipInstallFlags = [ "--ignore-installed" ]; + + # Adds setuptools to nativeBuildInputs causing infinite recursion. + catchConflicts = false; + + # Requires pytest, causing infinite recursion. + doCheck = false; + + meta = with lib; { + description = "Utilities to facilitate the installation of Python packages"; + homepage = "https://pypi.python.org/pypi/setuptools"; + license = with licenses; [ psfl zpl20 ]; + platforms = python.meta.platforms; + priority = 10; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/setuptools/tag-date.patch b/nixpkgs/pkgs/development/python2-modules/setuptools/tag-date.patch new file mode 100644 index 000000000000..441177a5d17e --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/setuptools/tag-date.patch @@ -0,0 +1,12 @@ +diff --git a/setup.cfg b/setup.cfg +index f23714b6..8aaeb330 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -1,6 +1,6 @@ + [egg_info] + tag_build = .post +-tag_date = 1 ++tag_date = 0 + + [aliases] + clean_egg_info = egg_info -Db '' diff --git a/nixpkgs/pkgs/development/python2-modules/typing/default.nix b/nixpkgs/pkgs/development/python2-modules/typing/default.nix new file mode 100644 index 000000000000..b8c143cbd537 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/typing/default.nix @@ -0,0 +1,32 @@ +{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, unittestCheckHook +, pythonAtLeast }: + +let + testDir = if isPy3k then "src" else "python2"; + +in buildPythonPackage rec { + pname = "typing"; + version = "3.10.0.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "13b4ad211f54ddbf93e5901a9967b1e07720c1d1b78d596ac6a439641aa1b130"; + }; + + disabled = pythonAtLeast "3.5"; + + # Error for Python3.6: ImportError: cannot import name 'ann_module' + # See https://github.com/python/typing/pull/280 + # Also, don't bother on PyPy: AssertionError: TypeError not raised + doCheck = pythonOlder "3.6" && !isPyPy; + + nativeCheckInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" testDir ]; + + meta = with lib; { + description = "Backport of typing module to Python versions older than 3.5"; + homepage = "https://docs.python.org/3/library/typing.html"; + license = licenses.psfl; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/wheel/0001-tests-Rename-a-a-o-_-.py-_-.py.patch b/nixpkgs/pkgs/development/python2-modules/wheel/0001-tests-Rename-a-a-o-_-.py-_-.py.patch new file mode 100644 index 000000000000..93db54b0c6e6 --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/wheel/0001-tests-Rename-a-a-o-_-.py-_-.py.patch @@ -0,0 +1,37 @@ +From 5879a4bbc34d1eb25e160b15b2f5a4f10eac6bd2 Mon Sep 17 00:00:00 2001 +From: toonn <toonn@toonn.io> +Date: Mon, 13 Sep 2021 18:07:26 +0200 +Subject: [PATCH] =?UTF-8?q?tests:=20Rename=20a=CC=8Aa=CC=88o=CC=88=5F?= + =?UTF-8?q?=E6=97=A5=E6=9C=AC=E8=AA=9E.py=20=3D>=20=C3=A6=C9=90=C3=B8=5F?= + =?UTF-8?q?=E6=97=A5=E6=9C=AC=E5=83=B9.py?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +`åäö_日本語.py` normalizes differently in NFC and NFD normal forms. This +means a hash generated for the source directory can differ depending on +whether or not the filesystem is normalizing and which normal form it +uses. + +By renaming the file to `æɐø_日本價.py` we avoid this issue by using a +name that has the same encoding in each normal form. +--- + tests/test_bdist_wheel.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py +index 651c034..9b94ac8 100644 +--- a/tests/test_bdist_wheel.py ++++ b/tests/test_bdist_wheel.py +@@ -58,7 +58,7 @@ def test_unicode_record(wheel_paths): + with ZipFile(path) as zf: + record = zf.read('unicode.dist-0.1.dist-info/RECORD') + +- assert u'åäö_日本語.py'.encode('utf-8') in record ++ assert u'æɐø_日本價.py'.encode('utf-8') in record + + + def test_licenses_default(dummy_dist, monkeypatch, tmpdir): +-- +2.17.2 (Apple Git-113) + diff --git a/nixpkgs/pkgs/development/python2-modules/wheel/default.nix b/nixpkgs/pkgs/development/python2-modules/wheel/default.nix new file mode 100644 index 000000000000..8735a37b21ff --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/wheel/default.nix @@ -0,0 +1,57 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, bootstrapped-pip +, setuptools +}: + +buildPythonPackage rec { + pname = "wheel"; + version = "0.37.1"; + format = "other"; + + src = fetchFromGitHub { + owner = "pypa"; + repo = pname; + rev = version; + sha256 = "sha256-JlTmUPY3yo/uROyd3nW1dJa23zbLhgQTwcmqZkPOrHs="; + name = "${pname}-${version}-source"; + postFetch = '' + cd $out + mv tests/testdata/unicode.dist/unicodedist/åäö_日本語.py \ + tests/testdata/unicode.dist/unicodedist/æɐø_日本價.py + patch -p1 < ${./0001-tests-Rename-a-a-o-_-.py-_-.py.patch} + ''; + }; + + nativeBuildInputs = [ + bootstrapped-pip + setuptools + ]; + + # No tests in archive + doCheck = false; + pythonImportsCheck = [ "wheel" ]; + + # We add this flag to ignore the copy installed by bootstrapped-pip + pipInstallFlags = [ "--ignore-installed" ]; + + meta = with lib; { + homepage = "https://github.com/pypa/wheel"; + description = "A built-package format for Python"; + longDescription = '' + This library is the reference implementation of the Python wheel packaging standard, + as defined in PEP 427. + + It has two different roles: + + - A setuptools extension for building wheels that provides the bdist_wheel setuptools command + - A command line tool for working with wheel files + + It should be noted that wheel is not intended to be used as a library, + and as such there is no stable, public API. + ''; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ siriobalmelli ]; + }; +} diff --git a/nixpkgs/pkgs/development/python2-modules/zipp/default.nix b/nixpkgs/pkgs/development/python2-modules/zipp/default.nix new file mode 100644 index 000000000000..c256ed4f7ada --- /dev/null +++ b/nixpkgs/pkgs/development/python2-modules/zipp/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, pytest +, pytest-flake8 +, more-itertools +}: + +buildPythonPackage rec { + pname = "zipp"; + version = "1.0.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"; + }; + + nativeBuildInputs = [ setuptools-scm ]; + + propagatedBuildInputs = [ more-itertools ]; + + nativeCheckInputs = [ pytest pytest-flake8 ]; + + checkPhase = '' + pytest + ''; + + # Prevent infinite recursion with pytest + doCheck = false; + + meta = with lib; { + description = "Pathlib-compatible object wrapper for zip files"; + homepage = "https://github.com/jaraco/zipp"; + license = licenses.mit; + }; +} |