summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Bettens <louis@bettens.info>2022-03-29 18:00:16 +0200
committerLouis Bettens <louis@bettens.info>2022-03-30 10:33:17 +0200
commitbd84351def15c0fe7a8a387347a6f10b4805f6ca (patch)
tree3af6c4dbf5b0bc04ab933096382d7d04d33d91b6
parentf760f24de31ba7f01d3eecc017b499e738eefaec (diff)
python-cosmopolitan: init at 3.6.14
-rw-r--r--pkgs/development/interpreters/python-cosmopolitan/default.nix39
-rw-r--r--pkgs/development/interpreters/python-cosmopolitan/ioctl.patch12
-rw-r--r--pkgs/development/libraries/cosmopolitan/default.nix4
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 57 insertions, 0 deletions
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 { };