writers.PyPy{2,3}: init

This commit is contained in:
Markus S. Wamser 2021-12-11 14:02:38 +01:00
parent 4e42f6bcb3
commit b93e478777
4 changed files with 112 additions and 2 deletions

View file

@ -83,11 +83,22 @@
release based on GTK+3 and Python 3.
</para>
</listitem>
<listitem>
<para>
The <literal>writers.writePython2</literal> and corresponding
<literal>writers.writePython2Bin</literal> convenience
functions to create executable Python 2 scripts in the store
were removed in preparation of removal of the Python 2
interpreter. Scripts have to be converted to Python 3 for use
with <literal>writers.writePython3</literal> or
<literal>writers.writePyPy2</literal> needs to be used.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-22.05-notable-changes">
<title>Other Notable Changes</title>
<itemizedlist spacing="compact">
<itemizedlist>
<listitem>
<para>
The option
@ -113,6 +124,16 @@
socket <literal>/run/redis-${serverName}/redis.sock</literal>.
</para>
</listitem>
<listitem>
<para>
The
<literal>writers.writePyPy2</literal>/<literal>writers.writePyPy3</literal>
and corresponding
<literal>writers.writePyPy2Bin</literal>/<literal>writers.writePyPy3Bin</literal>
convenience functions to create executable Python 2/3 scripts
using the PyPy interpreter were added.
</para>
</listitem>
</itemizedlist>
</section>
</section>

View file

@ -34,7 +34,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- `pkgs.claws-mail-gtk2`, representing Claws Mail's older release version three, was removed in order to get rid of Python 2.
Please switch to `claws-mail`, which is Claws Mail's latest release based on GTK+3 and Python 3.
- The `writers.writePython2` and corrersponding `writers.writePython2Bin` convenience functions to create executable Python 2 scripts in the store were removed in preparation of removal of the Python 2 interpreter.
- The `writers.writePython2` and corresponding `writers.writePython2Bin` convenience functions to create executable Python 2 scripts in the store were removed in preparation of removal of the Python 2 interpreter.
Scripts have to be converted to Python 3 for use with `writers.writePython3` or `writers.writePyPy2` needs to be used.
## Other Notable Changes {#sec-release-22.05-notable-changes}
@ -53,3 +54,5 @@ In addition to numerous new and upgraded packages, this release has the followin
are only accessible by default
to the members of the Unix group `redis-${serverName}`
through the Unix socket `/run/redis-${serverName}/redis.sock`.
- The `writers.writePyPy2`/`writers.writePyPy3` and corresponding `writers.writePyPy2Bin`/`writers.writePyPy3Bin` convenience functions to create executable Python 2/3 scripts using the PyPy interpreter were added.

View file

@ -247,6 +247,24 @@ let
'');
} name;
# writePyPy2 takes a name an attributeset with libraries and some pypy2 sourcecode and
# returns an executable
#
# Example:
# writePyPy2 "test_pypy2" { libraries = [ pkgs.pypy2Packages.enum ]; } ''
# from enum import Enum
#
# class Test(Enum):
# a = "success"
#
# print Test.a
# ''
writePyPy2 = makePythonWriter pkgs.pypy2 pkgs.pypy2Packages;
# writePyPy2Bin takes the same arguments as writePyPy2 but outputs a directory (like writeScriptBin)
writePyPy2Bin = name:
writePyPy2 "/bin/${name}";
# writePython3 takes a name an attributeset with libraries and some python3 sourcecode and
# returns an executable
#
@ -265,6 +283,24 @@ let
writePython3Bin = name:
writePython3 "/bin/${name}";
# writePyPy3 takes a name an attributeset with libraries and some pypy3 sourcecode and
# returns an executable
#
# Example:
# writePyPy3 "test_pypy3" { libraries = [ pkgs.pypy3Packages.pyyaml ]; } ''
# import yaml
#
# y = yaml.load("""
# - test: success
# """)
# print(y[0]['test'])
# ''
writePyPy3 = makePythonWriter pkgs.pypy3 pkgs.pypy3Packages;
# writePyPy3Bin takes the same arguments as writePyPy3 but outputs a directory (like writeScriptBin)
writePyPy3Bin = name:
writePyPy3 "/bin/${name}";
};
in
writers // (aliases writers)

View file

@ -3,7 +3,9 @@
, lib
, nodePackages
, perlPackages
, pypy2Packages
, python3Packages
, pypy3Packages
, runCommand
, writers
, writeText
@ -53,6 +55,17 @@ let
print "success\n" if true;
'';
pypy2 = writePyPy2Bin "test-writers-pypy2-bin" { libraries = [ pypy2Packages.enum ]; } ''
from enum import Enum
class Test(Enum):
a = "success"
print Test.a
'';
python3 = writePython3Bin "test-writers-python3-bin" { libraries = [ python3Packages.pyyaml ]; } ''
import yaml
@ -61,6 +74,15 @@ let
""")
print(y[0]['test'])
'';
pypy3 = writePyPy3Bin "test-writers-pypy3-bin" { libraries = [ pypy3Packages.pyyaml ]; } ''
import yaml
y = yaml.load("""
- test: success
""")
print(y[0]['test'])
'';
};
simple = {
@ -99,6 +121,17 @@ let
print "success\n" if true;
'';
pypy2 = writePyPy2 "test-writers-pypy2" { libraries = [ pypy2Packages.enum ]; } ''
from enum import Enum
class Test(Enum):
a = "success"
print Test.a
'';
python3 = writePython3 "test-writers-python3" { libraries = [ python3Packages.pyyaml ]; } ''
import yaml
@ -108,9 +141,26 @@ let
print(y[0]['test'])
'';
pypy3 = writePyPy3 "test-writers-pypy3" { libraries = [ pypy3Packages.pyyaml ]; } ''
import yaml
y = yaml.load("""
- test: success
""")
print(y[0]['test'])
'';
pypy2NoLibs = writePyPy2 "test-writers-pypy2-no-libs" {} ''
print("success")
'';
python3NoLibs = writePython3 "test-writers-python3-no-libs" {} ''
print("success")
'';
pypy3NoLibs = writePyPy3 "test-writers-pypy3-no-libs" {} ''
print("success")
'';
};