Skip to content

Commit f53391e

Browse files
CzarekCzarek
authored andcommitted
Replaced the use of "exit()" with "sys.exit()", as this probably
the cause of a strange "NameError: exit" when using py2exe, see this topic: https://groups.google.com/d/topic/cefpython/6ucGMZsFojg/discussion
1 parent 0fd1b11 commit f53391e

13 files changed

Lines changed: 32 additions & 25 deletions

File tree

cefpython/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ cefpython_py27.so
3838
cefpython_py32.so
3939

4040
cython_includes/compile_time_constants.pxi
41+
42+
debug_32bit/
43+
debug_64bit/

cefpython/cef1/linux/compile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@
4646
if ret != 0:
4747
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
4848
if what != "y":
49-
exit()
49+
sys.exit()
5050

5151
os.chdir("./../cef1/client_handler/")
5252
ret = subprocess.call("make -f Makefile", shell=True)
5353
if ret != 0:
5454
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
5555
if what != "y":
56-
exit()
56+
sys.exit()
5757

5858
os.chdir("./../v8function_handler/")
5959
ret = subprocess.call("make -f Makefile", shell=True)
6060
if ret != 0:
6161
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
6262
if what != "y":
63-
exit()
63+
sys.exit()
6464

6565
os.chdir("./../linux/")
6666

cefpython/cef1/linux/setup/fix_includes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import re
2525
import shutil
26+
import sys
2627

2728
def ExceptAllMissing(content):
2829

@@ -60,15 +61,15 @@ def ExceptAllMissing(content):
6061

6162
pyxfiles = glob.glob("../../../*.pyx")
6263
if not len(pyxfiles):
63-
exit(1)
64+
sys.exit(1)
6465
pyxfiles = [file for file in pyxfiles if file.find(mainfile) == -1]
6566
# Now, pyxfiles contains all pyx files except the mainfile (cefpython.pyx),
6667
# we do not fix includes in mainfile.
6768

6869
# So that this is the right directory we're in.
6970
if os.path.exists("setup"):
7071
print("Wrong directory, we should be inside setup!")
71-
exit()
72+
sys.exit(1)
7273

7374
# Remove old pyx files in setup directory.
7475
oldpyxfiles = glob.glob("./*.pyx")
@@ -94,7 +95,7 @@ def ExceptAllMissing(content):
9495
if lineNumber:
9596
print("WARNING: 'except *' missing in a cdef/cpdef function, "
9697
"in file %s on line %d" % (os.path.basename(pyxfile), lineNumber))
97-
exit(1)
98+
sys.exit(1)
9899
# Do not remove the newline - so that line numbers are exact with originals.
99100
(content, subs) = re.subn(r"^include[\t ]+[\"'][^\"'\n\r]+[\"'][\t ]*", "", content, flags=re.MULTILINE)
100101
if subs:

cefpython/cef1/windows/setup/fix_includes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import re
2525
import shutil
26+
import sys
2627

2728
def ExceptAllMissing(content):
2829

@@ -60,15 +61,15 @@ def ExceptAllMissing(content):
6061

6162
pyxfiles = glob.glob("../../../*.pyx")
6263
if not len(pyxfiles):
63-
exit(1)
64+
sys.exit(1)
6465
pyxfiles = [file for file in pyxfiles if file.find(mainfile) == -1]
6566
# Now, pyxfiles contains all pyx files except the mainfile (cefpython.pyx),
6667
# we do not fix includes in mainfile.
6768

6869
# So that this is the right directory we're in.
6970
if os.path.exists("setup"):
7071
print("Wrong directory, we should be inside setup!")
71-
exit()
72+
sys.exit(1)
7273

7374
# Remove old pyx files in setup directory.
7475
oldpyxfiles = glob.glob("./*.pyx")
@@ -94,7 +95,7 @@ def ExceptAllMissing(content):
9495
if lineNumber:
9596
print("WARNING: 'except *' missing in a cdef/cpdef function, "
9697
"in file %s on line %d" % (os.path.basename(pyxfile), lineNumber))
97-
exit(1)
98+
sys.exit(1)
9899
# Do not remove the newline - so that line numbers are exact with originals.
99100
(content, subs) = re.subn(r"^include[\t ]+[\"'][^\"'\n\r]+[\"'][\t ]*", "", content, flags=re.MULTILINE)
100101
if subs:

cefpython/cef3/linux/binaries_32bit/wxpython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def ExceptHook(excType, excValue, traceObject):
5353
import traceback, os, time, codecs
5454
# This hook does the following: in case of exception write it to
5555
# the "error.log" file, display it to the console, shutdown CEF
56-
# and exit application immediately by ignoring "finally" (_exit()).
56+
# and exit application immediately by ignoring "finally" (os._exit()).
5757
errorMsg = "\n".join(traceback.format_exception(excType, excValue,
5858
traceObject))
5959
errorFile = GetApplicationPath("error.log")

cefpython/cef3/linux/binaries_64bit/wxpython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def ExceptHook(excType, excValue, traceObject):
5353
import traceback, os, time, codecs
5454
# This hook does the following: in case of exception write it to
5555
# the "error.log" file, display it to the console, shutdown CEF
56-
# and exit application immediately by ignoring "finally" (_exit()).
56+
# and exit application immediately by ignoring "finally" (os._exit()).
5757
errorMsg = "\n".join(traceback.format_exception(excType, excValue,
5858
traceObject))
5959
errorFile = GetApplicationPath("error.log")

cefpython/cef3/linux/compile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@
4747
if ret != 0:
4848
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
4949
if what != "y":
50-
exit()
50+
sys.exit(1)
5151

5252
os.chdir("./../cef3/client_handler/")
5353
ret = subprocess.call("make -f Makefile", shell=True)
5454
if ret != 0:
5555
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
5656
if what != "y":
57-
exit()
57+
sys.exit(1)
5858

5959
os.chdir("./../subprocess/")
6060
ret = subprocess.call("make -f Makefile", shell=True)
6161
if ret != 0:
6262
what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
6363
if what != "y":
64-
exit()
64+
sys.exit(1)
6565
subprocess_exe = "./../linux/binaries_%s/subprocess" % (BITS)
6666
shutil.copyfile("./subprocess", subprocess_exe)
6767
st = os.stat(subprocess_exe)
@@ -72,7 +72,7 @@
7272
# if ret != 0:
7373
# what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
7474
# if what != "y":
75-
# exit()
75+
# sys.exit(1)
7676

7777
os.chdir("./../linux/")
7878

cefpython/cef3/linux/setup/fix_includes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import re
2525
import shutil
26+
import sys
2627

2728
def ExceptAllMissing(content):
2829

@@ -60,15 +61,15 @@ def ExceptAllMissing(content):
6061

6162
pyxfiles = glob.glob("../../../*.pyx")
6263
if not len(pyxfiles):
63-
exit(1)
64+
sys.exit(1)
6465
pyxfiles = [file for file in pyxfiles if file.find(mainfile) == -1]
6566
# Now, pyxfiles contains all pyx files except the mainfile (cefpython.pyx),
6667
# we do not fix includes in mainfile.
6768

6869
# So that this is the right directory we're in.
6970
if os.path.exists("setup"):
7071
print("Wrong directory, we should be inside setup!")
71-
exit()
72+
sys.exit(1)
7273

7374
# Remove old pyx files in setup directory.
7475
oldpyxfiles = glob.glob("./*.pyx")
@@ -94,7 +95,7 @@ def ExceptAllMissing(content):
9495
if lineNumber:
9596
print("WARNING: 'except *' missing in a cdef/cpdef function, "
9697
"in file %s on line %d" % (os.path.basename(pyxfile), lineNumber))
97-
exit(1)
98+
sys.exit(1)
9899
# Do not remove the newline - so that line numbers are exact with originals.
99100
(content, subs) = re.subn(r"^include[\t ]+[\"'][^\"'\n\r]+[\"'][\t ]*", "", content, flags=re.MULTILINE)
100101
if subs:

cefpython/cef3/windows/binaries/pyqt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def ExceptHook(excType, excValue, traceObject):
4646
import traceback, os, time, codecs
4747
# This hook does the following: in case of exception write it to
4848
# the "error.log" file, display it to the console, shutdown CEF
49-
# and exit application immediately by ignoring "finally" (_exit()).
49+
# and exit application immediately by ignoring "finally" (os._exit()).
5050
errorMsg = "\n".join(traceback.format_exception(excType, excValue,
5151
traceObject))
5252
errorFile = GetApplicationPath("error.log")

cefpython/cef3/windows/binaries/pyside.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def ExceptHook(excType, excValue, traceObject):
4848
import traceback, os, time, codecs
4949
# This hook does the following: in case of exception write it to
5050
# the "error.log" file, display it to the console, shutdown CEF
51-
# and exit application immediately by ignoring "finally" (_exit()).
51+
# and exit application immediately by ignoring "finally" (os._exit()).
5252
errorMsg = "\n".join(traceback.format_exception(excType, excValue,
5353
traceObject))
5454
errorFile = GetApplicationPath("error.log")

0 commit comments

Comments
 (0)