()
| 759 | |
| 760 | |
| 761 | def build_cefpython_module(): |
| 762 | # if DEBUG_FLAG: |
| 763 | # ret = subprocess.call("python-dbg setup.py build_ext --inplace" |
| 764 | # " --cython-gdb", shell=True) |
| 765 | |
| 766 | print("[build.py] Execute cython_setup.py script") |
| 767 | print("") |
| 768 | |
| 769 | os.chdir(BUILD_CEFPYTHON) |
| 770 | |
| 771 | enable_profiling = "" |
| 772 | if ENABLE_PROFILING: |
| 773 | enable_profiling = "--enable-profiling" |
| 774 | enable_line_tracing = "" |
| 775 | if ENABLE_LINE_TRACING: |
| 776 | enable_line_tracing = "--enable-line-tracing" |
| 777 | |
| 778 | command = ("\"{python}\" {tools_dir}/cython_setup.py build_ext" |
| 779 | " {enable_profiling} {enable_line_tracing}" |
| 780 | .format(python=sys.executable, tools_dir=TOOLS_DIR, |
| 781 | enable_profiling=enable_profiling, |
| 782 | enable_line_tracing=enable_line_tracing)) |
| 783 | if FAST_FLAG: |
| 784 | command += " --fast" |
| 785 | ret = subprocess.call(command, shell=True) |
| 786 | |
| 787 | # if DEBUG_FLAG: |
| 788 | # shutil.rmtree("./../binaries_%s/cython_debug/" % BITS, |
| 789 | # ignore_errors=True) |
| 790 | # shutil.copytree("./cython_debug/", |
| 791 | # "./../binaries_%s/cython_debug/" % BITS) |
| 792 | |
| 793 | # Remove .pyx files |
| 794 | oldpyxfiles = glob.glob("./*.pyx") |
| 795 | print("") |
| 796 | print("[build.py] Cleanup: remove pyx files in build_cefpython/") |
| 797 | for pyxfile in oldpyxfiles: |
| 798 | if os.path.exists(pyxfile): |
| 799 | os.remove(pyxfile) |
| 800 | |
| 801 | # Check if built succeeded after pyx files were removed |
| 802 | if ret != 0: |
| 803 | if FIRST_RUN and os.path.exists(CEFPYTHON_API_HFILE): |
| 804 | print("[build.py] INFO: looks like this was first run and" |
| 805 | " building the cefpython module is expected to fail" |
| 806 | " in such case due to cefpython API header file not" |
| 807 | " being generated yet. Will re-run the build.py script" |
| 808 | " programmatically now.") |
| 809 | args = list() |
| 810 | args.append("\"{python}\"".format(python=sys.executable)) |
| 811 | args.append(os.path.join(TOOLS_DIR, os.path.basename(__file__))) |
| 812 | assert os.path.basename(__file__) in sys.argv[0] |
| 813 | args.extend(SYS_ARGV_ORIGINAL[1:]) |
| 814 | command = " ".join(args) |
| 815 | print("[build.py] Running command: %s" % command) |
| 816 | ret = subprocess.call(command, shell=True) |
| 817 | # Always pass fixed value to sys.exit, read note at |
| 818 | # the top of the script about os.system and sys.exit |
no test coverage detected