Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 129 lines 3.5 kB view raw
1# Hooks for building Python packages. 2{ python 3, callPackage 4, makeSetupHook 5, disabledIf 6, isPy3k 7, ensureNewerSourcesForZipFilesHook 8}: 9 10let 11 pythonInterpreter = python.pythonForBuild.interpreter; 12 pythonSitePackages = python.sitePackages; 13 pythonCheckInterpreter = python.interpreter; 14 setuppy = ../run_setup.py; 15in rec { 16 17 eggBuildHook = callPackage ({ }: 18 makeSetupHook { 19 name = "egg-build-hook.sh"; 20 deps = [ ]; 21 } ./egg-build-hook.sh) {}; 22 23 eggInstallHook = callPackage ({ setuptools }: 24 makeSetupHook { 25 name = "egg-install-hook.sh"; 26 deps = [ setuptools ]; 27 substitutions = { 28 inherit pythonInterpreter pythonSitePackages; 29 }; 30 } ./egg-install-hook.sh) {}; 31 32 eggUnpackHook = callPackage ({ }: 33 makeSetupHook { 34 name = "egg-unpack-hook.sh"; 35 deps = [ ]; 36 } ./egg-unpack-hook.sh) {}; 37 38 flitBuildHook = callPackage ({ flit }: 39 makeSetupHook { 40 name = "flit-build-hook"; 41 deps = [ flit ]; 42 substitutions = { 43 inherit pythonInterpreter; 44 }; 45 } ./flit-build-hook.sh) {}; 46 47 pipBuildHook = callPackage ({ pip, wheel }: 48 makeSetupHook { 49 name = "pip-build-hook.sh"; 50 deps = [ pip wheel ]; 51 substitutions = { 52 inherit pythonInterpreter pythonSitePackages; 53 }; 54 } ./pip-build-hook.sh) {}; 55 56 pipInstallHook = callPackage ({ pip }: 57 makeSetupHook { 58 name = "pip-install-hook"; 59 deps = [ pip ]; 60 substitutions = { 61 inherit pythonInterpreter pythonSitePackages; 62 }; 63 } ./pip-install-hook.sh) {}; 64 65 pytestCheckHook = callPackage ({ pytest }: 66 makeSetupHook { 67 name = "pytest-check-hook"; 68 deps = [ pytest ]; 69 substitutions = { 70 inherit pythonCheckInterpreter; 71 }; 72 } ./pytest-check-hook.sh) {}; 73 74 pythonCatchConflictsHook = callPackage ({ setuptools }: 75 makeSetupHook { 76 name = "python-catch-conflicts-hook"; 77 deps = [ setuptools ]; 78 substitutions = { 79 inherit pythonInterpreter; 80 catchConflicts=../catch_conflicts/catch_conflicts.py; 81 }; 82 } ./python-catch-conflicts-hook.sh) {}; 83 84 pythonImportsCheckHook = callPackage ({}: 85 makeSetupHook { 86 name = "python-imports-check-hook.sh"; 87 substitutions = { 88 inherit pythonCheckInterpreter; 89 }; 90 } ./python-imports-check-hook.sh) {}; 91 92 pythonRemoveBinBytecodeHook = callPackage ({ }: 93 makeSetupHook { 94 name = "python-remove-bin-bytecode-hook"; 95 } ./python-remove-bin-bytecode-hook.sh) {}; 96 97 setuptoolsBuildHook = callPackage ({ setuptools, wheel }: 98 makeSetupHook { 99 name = "setuptools-setup-hook"; 100 deps = [ setuptools wheel ]; 101 substitutions = { 102 inherit pythonInterpreter pythonSitePackages setuppy; 103 }; 104 } ./setuptools-build-hook.sh) {}; 105 106 setuptoolsCheckHook = callPackage ({ setuptools }: 107 makeSetupHook { 108 name = "setuptools-check-hook"; 109 deps = [ setuptools ]; 110 substitutions = { 111 inherit pythonCheckInterpreter setuppy; 112 }; 113 } ./setuptools-check-hook.sh) {}; 114 115 venvShellHook = disabledIf (!isPy3k) (callPackage ({ }: 116 makeSetupHook { 117 name = "venv-shell-hook"; 118 deps = [ ensureNewerSourcesForZipFilesHook ]; 119 substitutions = { 120 inherit pythonInterpreter; 121 }; 122 } ./venv-shell-hook.sh) {}); 123 124 wheelUnpackHook = callPackage ({ wheel }: 125 makeSetupHook { 126 name = "wheel-unpack-hook.sh"; 127 deps = [ wheel ]; 128 } ./wheel-unpack-hook.sh) {}; 129}