NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.73k stars 13.86k forks source link

Cython is missing executables #307596

Open deliciouslytyped opened 5 months ago

deliciouslytyped commented 5 months ago

For example, these exist in the cython source tree but I cant find them anywhere on my machine or with nix-locate.

xref https://github.com/cython/cython/issues/6170

cython packaged at https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/python-modules/cython

Artturin commented 5 months ago

Alpine doesn't install those either so should be a upstream issue https://pkgs.alpinelinux.org/contents?file=&path=&name=cython&branch=edge&repo=main&arch=x86_64, they can be installed in the derivation if that is the intention of upstream.

deliciouslytyped commented 5 months ago

Yeah, after looking into this some more I forgot to update the issue. I'm not familiar with python packaging but it seems like whatever python binary packages are these days, the scripts and 'entry_points' directives in setup.py result in their implicit inclusion and installation. This wasn't exactly clear to me from any of the setuptools documentation but it can more-or-less be inferred. Also IIRC the specific mechanism seems to be limited to unix systems and python files but I'd have to recheck what the precise conditions were for what.

Patching the below does successfully result in adding cythonrun at least. https://github.com/cython/cython/blob/8d5eb48473db9fda485c215683a6f22d1bb91c08/setup.py#L67-L79

(for cython 0.29.34:)

diff --git a/Cython/Build/BuildExecutable.py b/Cython/Build/BuildExecutable.py
index 2db9e5d..293e744 100644
--- a/Cython/Build/BuildExecutable.py
+++ b/Cython/Build/BuildExecutable.py
@@ -138,5 +138,8 @@ def build_and_run(args):
     program_name = build(input_file, cy_args)
     exec_file(program_name, args)

-if __name__ == '__main__':
+def main():
     build_and_run(sys.argv[1:])
+
+if __name__ == '__main__':
+    main()
diff --git a/setup.py b/setup.py
index 027e0fc..b937afd 100755
--- a/setup.py
+++ b/setup.py
@@ -69,13 +69,14 @@ if 'setuptools' in sys.modules:
         'console_scripts': [
             'cython = Cython.Compiler.Main:setuptools_main',
             'cythonize = Cython.Build.Cythonize:main',
+            'cythonrun = Cython.Build.BuildExecutable:main',
             'cygdb = Cython.Debugger.Cygdb:main',
         ]
     }
     scripts = []
 else:
     if os.name == "posix":
-        scripts = ["bin/cython", "bin/cythonize", "bin/cygdb"]
+        scripts = ["bin/cython", "bin/cythonize", "bin/cygdb", "bin/cythonrun"]
     else:
         scripts = ["cython.py", "cythonize.py", "cygdb.py"]
Artturin commented 5 months ago

Submit upstream and see what they say?

Artturin commented 1 month ago

Submit upstream and see what they say?

Bump