Skip to content

Commit 3972f7c

Browse files
committed
Build cpp_utils with setuptools
1 parent a7a3906 commit 3972f7c

1 file changed

Lines changed: 17 additions & 22 deletions

File tree

src/linux/compile.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,27 @@
131131
# fails and then run the compile.py script again and this time
132132
# make should succeed.
133133

134+
def run_setuptools_build():
135+
ret = subprocess.call("{python} setup.py build_ext --inplace {fast}"
136+
.format(python=sys.executable,
137+
fast=('--fast' if FAST_FLAG else '')), shell=True)
138+
139+
140+
if ret != 0:
141+
what = input("%s build failed, press 'y' to continue, 'n' to stop: " % os.path.basename('.'))
142+
if what != "y":
143+
sys.exit(1)
144+
145+
return ret
146+
134147
# -------- CPP_UTILS_DIR
135148

136149
os.chdir(CPP_UTILS_DIR)
137150
if not FAST_FLAG:
138151
subprocess.call("rm -f *.o *.a", shell=True)
139152

140-
ret = subprocess.call("make -f Makefile", shell=True)
141-
if ret != 0:
142-
# noinspection PyUnboundLocalVariable
143-
what = input("make failed, press 'y' to continue, 'n' to stop: ")
144-
if what != "y":
145-
sys.exit(1)
153+
run_setuptools_build()
154+
146155

147156
# -------- CLIENT_HANDLER_DIR
148157

@@ -163,13 +172,7 @@
163172
subprocess.call("rm -f *.o *.a", shell=True)
164173
subprocess.call("rm -f subprocess", shell=True)
165174

166-
ret = subprocess.call("{python} setup.py build_ext --inplace {fast}"
167-
.format(python=sys.executable,
168-
fast=('--fast' if FAST_FLAG else '')), shell=True)
169-
if ret != 0:
170-
what = input("subprocess build failed, press 'y' to continue, 'n' to stop: ")
171-
if what != "y":
172-
sys.exit(1)
175+
run_setuptools_build()
173176

174177
subprocess_exe = os.path.join(CEFPYTHON_BINARY, "subprocess")
175178
if os.path.exists("./subprocess"):
@@ -214,15 +217,7 @@
214217
with open("__version__.pyx", "w") as fo:
215218
fo.write('__version__ = "{}"\n'.format(VERSION))
216219

217-
# if DEBUG_FLAG:
218-
# ret = subprocess.call("python-dbg setup.py build_ext --inplace"
219-
# " --cython-gdb", shell=True)
220-
if FAST_FLAG:
221-
ret = subprocess.call("{python} setup.py build_ext --inplace --fast"
222-
.format(python=sys.executable), shell=True)
223-
else:
224-
ret = subprocess.call("{python} setup.py build_ext --inplace"
225-
.format(python=sys.executable), shell=True)
220+
ret = run_setuptools_build()
226221

227222
# if DEBUG_FLAG:
228223
# shutil.rmtree("./../binaries_%s/cython_debug/" % BITS,

0 commit comments

Comments
 (0)