Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 120 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 python27, 5 callPackage, 6 fetchFromGitHub, 7 makeWrapper, 8 re2c, 9 # oil deps 10 glibcLocales, 11 file, 12 six, 13 typing, 14}: 15 16{ 17 /* 18 Upstream isn't interested in packaging this as a library 19 (or accepting all of the patches we need to do so). 20 This creates one without disturbing upstream too much. 21 */ 22 oildev = python27.pkgs.buildPythonPackage rec { 23 pname = "oildev-unstable"; 24 version = "2024-02-26"; 25 26 src = fetchFromGitHub { 27 owner = "oilshell"; 28 repo = "oil"; 29 # rev == present HEAD of release/0.20.0 30 rev = "f730c79e2dcde4bc08e85a718951cfa42102bd01"; 31 hash = "sha256-HBj3Izh1gD63EzbgZ/9If5vihR5L2HhnyCyMah6rMg4="; 32 33 /* 34 It's not critical to drop most of these; the primary target is 35 the vendored fork of Python-2.7.13, which is ~ 55M and over 3200 36 files, dozens of which get interpreter script patches in fixup. 37 38 Note: -f is necessary to keep it from being a pain to update 39 hash on rev updates. Command will fail w/o and not print hash. 40 */ 41 postFetch = '' 42 rm -rf $out/{Python-2.7.13,metrics,py-yajl,rfc,gold,web,testdata,services,demo} 43 ''; 44 }; 45 46 # patch to support a python package, pass tests on macOS, drop deps, etc. 47 patchSrc = fetchFromGitHub { 48 owner = "abathur"; 49 repo = "nix-py-dev-oil"; 50 rev = "v0.20.0.0"; 51 hash = "sha256-qoA54rnzAdnFZ3k4kRzQWEdgtEjraCT5+NFw8AWnRDk="; 52 }; 53 54 patches = [ 55 "${patchSrc}/0001-add_setup_py.patch" 56 "${patchSrc}/0002-add_MANIFEST_in.patch" 57 "${patchSrc}/0006-disable_failing_libc_tests.patch" 58 "${patchSrc}/0007-namespace_via_init.patch" 59 "${patchSrc}/0009-avoid_nix_arch64_darwin_toolchain_bug.patch" 60 "${patchSrc}/0010-disable-line-input.patch" 61 "${patchSrc}/0011-disable-fanos.patch" 62 "${patchSrc}/0012-disable-doc-cmark.patch" 63 "${patchSrc}/0013-fix-pyverify.patch" 64 "${patchSrc}/0015-fix-compiled-extension-import-paths.patch" 65 ]; 66 67 configureFlags = [ 68 "--without-readline" 69 ]; 70 71 nativeBuildInputs = [ 72 re2c 73 file 74 makeWrapper 75 ]; 76 77 propagatedBuildInputs = [ 78 six 79 typing 80 ]; 81 82 doCheck = true; 83 84 preBuild = '' 85 build/py.sh all 86 ''; 87 88 postPatch = '' 89 patchShebangs asdl build core doctools frontend pyext oil_lang ysh 90 rm cpp/stdlib.h # keep modules from finding the wrong stdlib? 91 # work around hard parse failure documented in oilshell/oil#1468 92 substituteInPlace osh/cmd_parse.py --replace 'elif self.c_id == Id.Op_LParen' 'elif False' 93 ''; 94 95 # See earlier note on glibcLocales TODO: verify needed? 96 LOCALE_ARCHIVE = lib.optionalString ( 97 stdenv.buildPlatform.libc == "glibc" 98 ) "${glibcLocales}/lib/locale/locale-archive"; 99 100 # not exhaustive; sample what resholve uses as a sanity check 101 pythonImportsCheck = [ 102 "oil" 103 "oil.asdl" 104 "oil.core" 105 "oil.frontend" 106 "oil._devbuild" 107 "oil._devbuild.gen.id_kind_asdl" 108 "oil._devbuild.gen.syntax_asdl" 109 "oil.osh" 110 "oil.tools.ysh_ify" 111 ]; 112 113 meta = { 114 license = with lib.licenses; [ 115 psfl # Includes a portion of the python interpreter and standard library 116 asl20 # Licence for Oil itself 117 ]; 118 }; 119 }; 120}