From 0a2caa41fe0da9e5c36f47994594650f00e1d111 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Thu, 3 Jan 2019 10:05:50 +0100 Subject: [PATCH] Python: drop `python.majorVersion` Drop `python.majorVersion`. For Python language version, use `python.pythonVersion`. For implementation version, use `python.sourceVersion`. Some expressions were broken. Those that were identified were fixed. fixup major --- pkgs/applications/audio/ingen/default.nix | 2 +- pkgs/applications/misc/blender/default.nix | 10 +++++----- .../instant-messengers/profanity/default.nix | 2 +- pkgs/applications/science/misc/golly/beta.nix | 4 ++-- pkgs/applications/science/misc/golly/default.nix | 5 ++--- pkgs/development/interpreters/python/default.nix | 2 -- .../libraries/physics/geant4/g4py/default.nix | 2 +- pkgs/development/python-modules/tensorflow/bin.nix | 2 +- pkgs/tools/misc/calamares/default.nix | 4 ++-- pkgs/tools/networking/unbound/python.nix | 6 +++--- 10 files changed, 18 insertions(+), 21 deletions(-) diff --git a/pkgs/applications/audio/ingen/default.nix b/pkgs/applications/audio/ingen/default.nix index e10a25b89174..1e249b51fb76 100644 --- a/pkgs/applications/audio/ingen/default.nix +++ b/pkgs/applications/audio/ingen/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { for program in ingenams ingenish do wrapProgram $out/bin/$program \ - --prefix PYTHONPATH : $out/lib/python${python.majorVersion}/site-packages:$PYTHONPATH + --prefix PYTHONPATH : $out/${python.sitePackages}:$PYTHONPATH done ''; diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index b9d4b83e4f1f..340c08a958e1 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -51,10 +51,10 @@ stdenv.mkDerivation rec { "-DWITH_SYSTEM_OPENJPEG=ON" "-DWITH_PLAYER=ON" "-DWITH_OPENSUBDIV=ON" - "-DPYTHON_LIBRARY=python${python.majorVersion}m" + "-DPYTHON_LIBRARY=${python.libPrefix}" "-DPYTHON_LIBPATH=${python}/lib" - "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m" - "-DPYTHON_VERSION=${python.majorVersion}" + "-DPYTHON_INCLUDE_DIR=${python}/include/${python.libPrefix}" + "-DPYTHON_VERSION=${python.pythonVersion}" "-DWITH_PYTHON_INSTALL=OFF" "-DWITH_PYTHON_INSTALL_NUMPY=OFF" ] @@ -66,7 +66,7 @@ stdenv.mkDerivation rec { ] ++ optional colladaSupport "-DWITH_OPENCOLLADA=ON"; - NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR -I${python}/include/${python.libPrefix}m"; + NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR -I${python}/include/${python.libPrefix}"; # Since some dependencies are built with gcc 6, we need gcc 6's # libstdc++ in our RPATH. Sigh. @@ -77,7 +77,7 @@ stdenv.mkDerivation rec { postInstall = optionalString enableNumpy '' wrapProgram $out/bin/blender \ - --prefix PYTHONPATH : ${pythonPackages.numpy}/lib/python${python.majorVersion}/site-packages + --prefix PYTHONPATH : ${pythonPackages.numpy}/${python.sitePackages} ''; meta = with stdenv.lib; { diff --git a/pkgs/applications/networking/instant-messengers/profanity/default.nix b/pkgs/applications/networking/instant-messengers/profanity/default.nix index 327b02b23526..cf852ada369f 100644 --- a/pkgs/applications/networking/instant-messengers/profanity/default.nix +++ b/pkgs/applications/networking/instant-messengers/profanity/default.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { ++ optionals pythonPluginSupport [ "-I${python}/include/${python.libPrefix}" ]; LDFLAGS = [ ] - ++ optionals pythonPluginSupport [ "-L${python}/lib" "-lpython${python.majorVersion}m" ]; + ++ optionals pythonPluginSupport [ "-L${python}/lib" "-l${python.libPrefix}" ]; meta = { description = "A console based XMPP client"; diff --git a/pkgs/applications/science/misc/golly/beta.nix b/pkgs/applications/science/misc/golly/beta.nix index 83b9c5a04a19..6f11caf4d9ab 100644 --- a/pkgs/applications/science/misc/golly/beta.nix +++ b/pkgs/applications/science/misc/golly/beta.nix @@ -4,7 +4,7 @@ }: stdenv.mkDerivation rec { - name = "golly-${version}"; + pname = "golly"; version = "2.8.99.2.20161122"; #src = fetchurl { # url="mirror://sourceforge/project/golly/golly/golly-2.8/golly-2.8-src.tar.gz"; @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { makeFlags=[ "AM_LDFLAGS=" ]; - NIX_LDFLAGS="-lpython${python2.majorVersion} -lperl"; + NIX_LDFLAGS="-l${python2.libPrefix} -lperl"; preConfigure='' export NIX_LDFLAGS="$NIX_LDFLAGS -L$(dirname "$(find ${perl} -name libperl.so)")" export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE diff --git a/pkgs/applications/science/misc/golly/default.nix b/pkgs/applications/science/misc/golly/default.nix index cfa4dca4b0de..74fa4cc02ed5 100644 --- a/pkgs/applications/science/misc/golly/default.nix +++ b/pkgs/applications/science/misc/golly/default.nix @@ -1,8 +1,7 @@ {stdenv, fetchurl, wxGTK, perl, python2, zlib, libGLU_combined, libX11}: stdenv.mkDerivation rec { - baseName="golly"; + pname = "golly"; version = "3.2"; - name="${baseName}-${version}"; src = fetchurl { sha256 = "0cg9mbwmf4q6qxhqlnzrxh9y047banxdb8pd3hgj3smmja2zf0jd"; @@ -21,7 +20,7 @@ stdenv.mkDerivation rec { makeFlags=[ "AM_LDFLAGS=" ]; - NIX_LDFLAGS="-lpython${python2.majorVersion} -lperl"; + NIX_LDFLAGS="-l${python2.libPrefix} -lperl"; preConfigure='' export NIX_LDFLAGS="$NIX_LDFLAGS -L$(dirname "$(find ${perl} -name libperl.so)")" export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 786ae76c1dd0..b45dc55390c9 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -39,8 +39,6 @@ with pkgs; pythonAtLeast = lib.versionAtLeast pythonVersion; pythonOlder = lib.versionOlder pythonVersion; inherit pythonForBuild; - - majorVersion = pythonVersion; # Backwards compatibility. Should be dropped. }; in { diff --git a/pkgs/development/libraries/physics/geant4/g4py/default.nix b/pkgs/development/libraries/physics/geant4/g4py/default.nix index 551d61af3ada..f28f0fd64203 100644 --- a/pkgs/development/libraries/physics/geant4/g4py/default.nix +++ b/pkgs/development/libraries/physics/geant4/g4py/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { preConfigure = '' # Fix for boost 1.67+ substituteInPlace CMakeLists.txt \ - --replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.majorVersion})" + --replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.pythonVersion})" for f in `find . -name CMakeLists.txt`; do substituteInPlace "$f" \ --replace "boost_python" "\''${Boost_LIBRARIES}" diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix index b925b74e03b5..90f8c9e6e302 100644 --- a/pkgs/development/python-modules/tensorflow/bin.nix +++ b/pkgs/development/python-modules/tensorflow/bin.nix @@ -45,7 +45,7 @@ in buildPythonPackage rec { format = "wheel"; src = let - pyVerNoDot = lib.strings.stringAsChars (x: if x == "." then "" else x) "${python.majorVersion}"; + pyVerNoDot = lib.strings.stringAsChars (x: if x == "." then "" else x) "${python.pythonVersion}"; pyver = if stdenv.isDarwin then builtins.substring 0 1 pyVerNoDot else pyVerNoDot; platform = if stdenv.isDarwin then "mac" else "linux"; unit = if cudaSupport then "gpu" else "cpu"; diff --git a/pkgs/tools/misc/calamares/default.nix b/pkgs/tools/misc/calamares/default.nix index c799b08bd446..edc6a2e46437 100644 --- a/pkgs/tools/misc/calamares/default.nix +++ b/pkgs/tools/misc/calamares/default.nix @@ -24,8 +24,8 @@ stdenv.mkDerivation rec { enableParallelBuilding = false; cmakeFlags = [ - "-DPYTHON_LIBRARY=${python}/lib/libpython${python.majorVersion}m.so" - "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m" + "-DPYTHON_LIBRARY=${python}/lib/lib${python.libPrefix}.so" + "-DPYTHON_INCLUDE_DIR=${python}/include/${python.libPrefix}" "-DCMAKE_VERBOSE_MAKEFILE=True" "-DCMAKE_BUILD_TYPE=Release" "-DWITH_PYTHONQT:BOOL=ON" diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix index 67e6f2e9c43f..c20169d39135 100644 --- a/pkgs/tools/networking/unbound/python.nix +++ b/pkgs/tools/networking/unbound/python.nix @@ -19,7 +19,7 @@ in stdenv.mkDerivation rec { --replace "\$(LIBTOOL) --mode=install cp _unbound.la" "cp _unbound.la" ''; - preConfigure = "export PYTHON_VERSION=${python.majorVersion}"; + preConfigure = "export PYTHON_VERSION=${python.pythonVersion}"; configureFlags = [ "--with-ssl=${openssl.dev}" @@ -46,13 +46,13 @@ in stdenv.mkDerivation rec { # All we want is the Unbound Python module postInstall = '' - # Generate the built in root anchor and root key and store these in a logical place + # Generate the built in root anchor and root key and store these in a logical place # to be used by tools depending only on the Python module $out/bin/unbound-anchor -l | head -1 > $out/etc/${pname}/root.anchor $out/bin/unbound-anchor -l | tail --lines=+2 - > $out/etc/${pname}/root.key # We don't need anything else rm -fR $out/bin $out/share $out/include $out/etc/unbound - patchelf --replace-needed libunbound.so.2 $out/${python.sitePackages}/libunbound.so.2 $out/${python.sitePackages}/_unbound.so + patchelf --replace-needed libunbound.so.2 $out/${python.sitePackages}/libunbound.so.2 $out/${python.sitePackages}/_unbound.so ''; meta = with stdenv.lib; {