From bd84351def15c0fe7a8a387347a6f10b4805f6ca Mon Sep 17 00:00:00 2001 From: Louis Bettens Date: Tue, 29 Mar 2022 18:00:16 +0200 Subject: python-cosmopolitan: init at 3.6.14 --- .../interpreters/python-cosmopolitan/default.nix | 39 ++++++++++++++++++++++ .../interpreters/python-cosmopolitan/ioctl.patch | 12 +++++++ .../development/libraries/cosmopolitan/default.nix | 4 +++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 57 insertions(+) create mode 100644 pkgs/development/interpreters/python-cosmopolitan/default.nix create mode 100644 pkgs/development/interpreters/python-cosmopolitan/ioctl.patch diff --git a/pkgs/development/interpreters/python-cosmopolitan/default.nix b/pkgs/development/interpreters/python-cosmopolitan/default.nix new file mode 100644 index 000000000000..07de40356d21 --- /dev/null +++ b/pkgs/development/interpreters/python-cosmopolitan/default.nix @@ -0,0 +1,39 @@ +{ lib, stdenv, cosmopolitan, unzip, bintools-unwrapped }: + +stdenv.mkDerivation rec { + pname = "python-cosmopolitan"; + version = "3.6.14"; + + src = cosmopolitan.dist; + + patches = [ + ./ioctl.patch # required /dev/tty + ]; + + nativeBuildInputs = [ bintools-unwrapped unzip ]; + + # slashes are significant because upstream uses o/$(MODE)/foo.o + buildFlags = "o//third_party/python"; + checkTarget = "o//third_party/python/test"; + enableParallelBuilding = true; + + doCheck = true; + dontConfigure = true; + dontFixup = true; + + installPhase = '' + runHook preInstall + install o/third_party/python/*.com -Dt $out/bin + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://justine.lol/cosmopolitan/"; + description = "Actually Portable Python using Cosmopolitan"; + platforms = platforms.x86_64; + badPlatforms = platforms.darwin; + license = licenses.isc; + maintainers = with maintainers; [ lourkeur tomberek ]; + mainProgram = "python.com"; + }; +} diff --git a/pkgs/development/interpreters/python-cosmopolitan/ioctl.patch b/pkgs/development/interpreters/python-cosmopolitan/ioctl.patch new file mode 100644 index 000000000000..e6e7eb4fc7b0 --- /dev/null +++ b/pkgs/development/interpreters/python-cosmopolitan/ioctl.patch @@ -0,0 +1,12 @@ +diff --git a/third_party/python/python.mk b/third_party/python/python.mk +index f18c15060..b17455bca 100644 +--- a/third_party/python/python.mk ++++ b/third_party/python/python.mk +@@ -1818,7 +1818,6 @@ THIRD_PARTY_PYTHON_PYTEST_PYMAINS = \ + third_party/python/Lib/test/test_int_literal.py \ + third_party/python/Lib/test/test_bisect.py \ + third_party/python/Lib/test/test_pyexpat.py \ +- third_party/python/Lib/test/test_ioctl.py \ + third_party/python/Lib/test/test_getopt.py \ + third_party/python/Lib/test/test_sort.py \ + third_party/python/Lib/test/test_slice.py \ diff --git a/pkgs/development/libraries/cosmopolitan/default.nix b/pkgs/development/libraries/cosmopolitan/default.nix index 6e3140fa5f0f..6a2374a97dc4 100644 --- a/pkgs/development/libraries/cosmopolitan/default.nix +++ b/pkgs/development/libraries/cosmopolitan/default.nix @@ -13,6 +13,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ bintools-unwrapped unzip ]; + outputs = [ "out" "dist" ]; + # slashes are significant because upstream uses o/$(MODE)/foo.o buildFlags = "o/cosmopolitan.h o//cosmopolitan.a o//libc/crt/crt.o o//ape/ape.o o//ape/ape.lds"; checkTarget = "o//test"; @@ -27,6 +29,8 @@ stdenv.mkDerivation rec { mkdir -p $out/{include,lib} install o/cosmopolitan.h $out/include install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} $out/lib + + cp -RT . "$dist" runHook postInstall ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a2a0fa1d3574..e93f871b3fff 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16520,6 +16520,8 @@ with pkgs; cosmopolitan = callPackage ../development/libraries/cosmopolitan { }; + python-cosmopolitan = callPackage ../development/interpreters/python-cosmopolitan { }; + ctl = callPackage ../development/libraries/ctl { }; ctpp2 = callPackage ../development/libraries/ctpp2 { }; -- cgit v1.2.3