Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython is missing executables #307596

Open
deliciouslytyped opened this issue Apr 29, 2024 · 3 comments
Open

Cython is missing executables #307596

deliciouslytyped opened this issue Apr 29, 2024 · 3 comments

Comments

@deliciouslytyped
Copy link
Contributor

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

xref cython/cython#6170

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

@Artturin
Copy link
Member

Artturin commented Apr 29, 2024

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
Copy link
Contributor Author

deliciouslytyped commented May 1, 2024

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
Copy link
Member

Artturin commented May 1, 2024

Submit upstream and see what they say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants