Skip to content

Commit f32fdbd

Browse files
committed
GR-43512: scipy 1.8.1 - cyhtonize in process
1 parent 5b992b3 commit f32fdbd

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed
Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/scipy/__init__.py b/scipy/__init__.py
2-
index f4af2ad8e..de3025b3c 100644
2+
index f4af2ad8..de3025b3 100644
33
--- a/scipy/__init__.py
44
+++ b/scipy/__init__.py
55
@@ -157,4 +157,4 @@ else:
@@ -8,3 +8,54 @@ index f4af2ad8e..de3025b3c 100644
88
# This makes "from scipy import fft" return scipy.fft, not np.fft
99
- del fft
1010
+ # del fft
11+
diff --git a/tools/cythonize.py b/tools/cythonize.py
12+
index 2e0179be..e6d71484 100755
13+
--- a/tools/cythonize.py
14+
+++ b/tools/cythonize.py
15+
@@ -95,24 +95,23 @@ def process_pyx(fromfile, tofile, cwd):
16+
if tofile.endswith('.cxx'):
17+
flags += ['--cplus']
18+
19+
- try:
20+
+ try:
21+
+ from Cython.Compiler.Main import setuptools_main
22+
+ prev_argv = sys.argv[1:]
23+
try:
24+
- r = subprocess.call(['cython'] + flags + ["-o", tofile, fromfile], cwd=cwd)
25+
- if r != 0:
26+
- raise Exception('Cython failed')
27+
- except OSError as e:
28+
- # There are ways of installing Cython that don't result in a cython
29+
- # executable on the path, see gh-2397.
30+
- r = subprocess.call([sys.executable, '-c',
31+
- 'import sys; from Cython.Compiler.Main import '
32+
- 'setuptools_main as main; sys.exit(main())'] + flags +
33+
- ["-o", tofile, fromfile],
34+
- cwd=cwd)
35+
- if r != 0:
36+
- raise Exception("Cython either isn't installed or it failed.") from e
37+
+ oldcwd = os.getcwd()
38+
+ os.chdir(cwd)
39+
+ sys.argv[1:] = flags + ["-o", tofile, fromfile]
40+
+ retcode = setuptools_main()
41+
+ if retcode:
42+
+ sys.exit(retcode)
43+
+ finally:
44+
+ sys.argv[1:] = prev_argv
45+
+ os.chdir(oldcwd)
46+
except OSError as e:
47+
raise OSError('Cython needs to be installed') from e
48+
49+
+
50+
def process_tempita_pyx(fromfile, tofile, cwd):
51+
try:
52+
try:
53+
@@ -253,7 +252,7 @@ def find_process_files(root_dir):
54+
lock = Lock()
55+
56+
try:
57+
- num_proc = int(os.environ.get('SCIPY_NUM_CYTHONIZE_JOBS', cpu_count()))
58+
+ num_proc = int(os.environ.get('SCIPY_NUM_CYTHONIZE_JOBS', 1))
59+
pool = Pool(processes=num_proc)
60+
except ImportError as e:
61+
# Allow building (single-threaded) on GNU/Hurd, which does not

0 commit comments

Comments
 (0)