2021-09-16 00:58:49 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-12-01 23:10:14 +00:00
|
|
|
, python27
|
2021-09-16 00:58:49 +00:00
|
|
|
, callPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
2024-02-13 05:54:24 +00:00
|
|
|
, re2c
|
2024-03-06 04:09:07 +00:00
|
|
|
, # oil deps
|
|
|
|
glibcLocales
|
2024-02-13 05:54:24 +00:00
|
|
|
, file
|
2022-12-09 23:11:59 +00:00
|
|
|
, six
|
|
|
|
, typing
|
2021-09-16 00:58:49 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rec {
|
2021-09-23 22:52:17 +00:00
|
|
|
/*
|
|
|
|
Upstream isn't interested in packaging this as a library
|
|
|
|
(or accepting all of the patches we need to do so).
|
|
|
|
This creates one without disturbing upstream too much.
|
|
|
|
*/
|
2022-12-01 23:10:14 +00:00
|
|
|
oildev = python27.pkgs.buildPythonPackage rec {
|
2021-09-16 00:58:49 +00:00
|
|
|
pname = "oildev-unstable";
|
2024-03-06 04:09:07 +00:00
|
|
|
version = "2024-02-26";
|
2021-09-16 00:58:49 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "oilshell";
|
|
|
|
repo = "oil";
|
2024-03-06 04:09:07 +00:00
|
|
|
# rev == present HEAD of release/0.20.0
|
|
|
|
rev = "f730c79e2dcde4bc08e85a718951cfa42102bd01";
|
|
|
|
hash = "sha256-HBj3Izh1gD63EzbgZ/9If5vihR5L2HhnyCyMah6rMg4=";
|
2021-09-16 00:58:49 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
It's not critical to drop most of these; the primary target is
|
|
|
|
the vendored fork of Python-2.7.13, which is ~ 55M and over 3200
|
|
|
|
files, dozens of which get interpreter script patches in fixup.
|
2021-09-23 22:52:17 +00:00
|
|
|
|
|
|
|
Note: -f is necessary to keep it from being a pain to update
|
|
|
|
hash on rev updates. Command will fail w/o and not print hash.
|
2021-09-16 00:58:49 +00:00
|
|
|
*/
|
2022-05-17 19:10:33 +00:00
|
|
|
postFetch = ''
|
2024-03-06 04:09:07 +00:00
|
|
|
rm -rf $out/{Python-2.7.13,metrics,py-yajl,rfc,gold,web,testdata,services,demo}
|
2021-09-16 00:58:49 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-01-29 02:49:29 +00:00
|
|
|
# patch to support a python package, pass tests on macOS, drop deps, etc.
|
2021-09-16 00:58:49 +00:00
|
|
|
patchSrc = fetchFromGitHub {
|
|
|
|
owner = "abathur";
|
|
|
|
repo = "nix-py-dev-oil";
|
2024-03-06 04:09:07 +00:00
|
|
|
rev = "v0.20.0.0";
|
|
|
|
hash = "sha256-qoA54rnzAdnFZ3k4kRzQWEdgtEjraCT5+NFw8AWnRDk=";
|
2021-09-16 00:58:49 +00:00
|
|
|
};
|
2024-03-06 04:09:07 +00:00
|
|
|
|
2021-09-16 00:58:49 +00:00
|
|
|
patches = [
|
|
|
|
"${patchSrc}/0001-add_setup_py.patch"
|
|
|
|
"${patchSrc}/0002-add_MANIFEST_in.patch"
|
|
|
|
"${patchSrc}/0006-disable_failing_libc_tests.patch"
|
|
|
|
"${patchSrc}/0007-namespace_via_init.patch"
|
2022-01-27 01:37:34 +00:00
|
|
|
"${patchSrc}/0009-avoid_nix_arch64_darwin_toolchain_bug.patch"
|
2023-01-29 02:49:29 +00:00
|
|
|
"${patchSrc}/0010-disable-line-input.patch"
|
|
|
|
"${patchSrc}/0011-disable-fanos.patch"
|
|
|
|
"${patchSrc}/0012-disable-doc-cmark.patch"
|
2023-09-22 03:33:38 +00:00
|
|
|
"${patchSrc}/0013-fix-pyverify.patch"
|
2024-03-06 04:09:07 +00:00
|
|
|
"${patchSrc}/0015-fix-compiled-extension-import-paths.patch"
|
2021-09-16 00:58:49 +00:00
|
|
|
];
|
|
|
|
|
2023-01-29 02:49:29 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--without-readline"
|
|
|
|
];
|
2021-09-16 00:58:49 +00:00
|
|
|
|
2024-03-06 04:09:07 +00:00
|
|
|
nativeBuildInputs = [ re2c file makeWrapper ];
|
2021-09-16 00:58:49 +00:00
|
|
|
|
2024-03-06 04:09:07 +00:00
|
|
|
propagatedBuildInputs = [ six typing ];
|
2021-09-16 00:58:49 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
preBuild = ''
|
2024-03-06 04:09:07 +00:00
|
|
|
build/py.sh all
|
2021-09-16 00:58:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-03-06 04:09:07 +00:00
|
|
|
patchShebangs asdl build core doctools frontend pyext oil_lang ysh
|
2023-01-29 02:49:29 +00:00
|
|
|
rm cpp/stdlib.h # keep modules from finding the wrong stdlib?
|
|
|
|
# work around hard parse failure documented in oilshell/oil#1468
|
|
|
|
substituteInPlace osh/cmd_parse.py --replace 'elif self.c_id == Id.Op_LParen' 'elif False'
|
2021-09-16 00:58:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# See earlier note on glibcLocales TODO: verify needed?
|
2024-03-06 04:09:07 +00:00
|
|
|
LOCALE_ARCHIVE = lib.optionalString (stdenv.buildPlatform.libc == "glibc") "${glibcLocales}/lib/locale/locale-archive";
|
2021-09-16 00:58:49 +00:00
|
|
|
|
2023-01-29 02:49:29 +00:00
|
|
|
# not exhaustive; sample what resholve uses as a sanity check
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"oil"
|
|
|
|
"oil.asdl"
|
|
|
|
"oil.core"
|
|
|
|
"oil.frontend"
|
|
|
|
"oil._devbuild"
|
|
|
|
"oil._devbuild.gen.id_kind_asdl"
|
|
|
|
"oil._devbuild.gen.syntax_asdl"
|
2024-03-06 04:09:07 +00:00
|
|
|
"oil.osh"
|
|
|
|
"oil.tools.ysh_ify"
|
2023-01-29 02:49:29 +00:00
|
|
|
];
|
2021-09-16 00:58:49 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
license = with lib.licenses; [
|
|
|
|
psfl # Includes a portion of the python interpreter and standard library
|
|
|
|
asl20 # Licence for Oil itself
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|