From 6cee1646e610092acbf9d159971648daaeeae938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= <105517825+cedrik-fuoco-adsk@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:03:29 -0500 Subject: [PATCH] Reverting changes made to make_python.py for VFX2024 (#649) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Reverting changes made to make_python.py for VFX2024 ### Linked issues n/a ### Summarize your change. Reverting changes that I made to support Python 3.11 for VFX2024. **Those changes were affecting Windows only**. ### Describe the reason for the change. Reverting the change to make sure that the next release goes smoothly. Currently, I am having a lot of issue with 3.11. I need to work on that separately. ### Describe what you have tested and on which operating system. Windows ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: CeĢdrik Fuoco --- src/build/make_python.py | 93 +++++++++++----------------------------- 1 file changed, 25 insertions(+), 68 deletions(-) diff --git a/src/build/make_python.py b/src/build/make_python.py index ae43359d1..0c74ee3cf 100755 --- a/src/build/make_python.py +++ b/src/build/make_python.py @@ -596,85 +596,42 @@ def install() -> None: shutil.rmtree(OUTPUT_DIR) if platform.system() == "Windows": - build_path = os.path.join(SOURCE_DIR, "PCBuild", "amd64") - parent = os.path.dirname(SOURCE_DIR) - - # Using the python that OpenRV built to execute the script because it seems - # like it need to be the same dot release. (e.g. run the script with 3.11 to install a 3.11) - python_executable = "python" - if VARIANT == "Debug": - python_executable = "python_d" - python_executable = os.path.join(build_path, python_executable) - - install_args = [ - python_executable, - os.path.join(SOURCE_DIR, "PC", "layout", "main.py"), - "-vv", - "--source", - SOURCE_DIR, - "--build", - build_path, - "--copy", - OUTPUT_DIR, - "--temp", - os.path.join(parent, "temp"), - "--include-dev", - "--include-symbols", - "--include-tcltk", - "--include-tests", - "--include-venv", - "--flat-dlls" - ] - - if VARIANT == "Debug": - install_args.append("--debug") + # include + src_dir = os.path.join(SOURCE_DIR, "Include") + dst_dir = os.path.join(OUTPUT_DIR, "include") + shutil.copytree(src_dir, dst_dir) + src_file = os.path.join(SOURCE_DIR, "PC", "pyconfig.h") + dst_file = os.path.join(dst_dir, "pyconfig.h") + shutil.copyfile(src_file, dst_file) - subprocess.run( - install_args, - cwd=SOURCE_DIR - ).check_returncode() + # lib + src_dir = os.path.join(SOURCE_DIR, "Lib") + dst_dir = os.path.join(OUTPUT_DIR, "lib") + shutil.copytree(src_dir, dst_dir) - dst_dir = os.path.join(OUTPUT_DIR, "bin") - os.makedirs(dst_dir, exist_ok=True) + # libs - required by pyside2 + dst_dir = os.path.join(OUTPUT_DIR, "libs") + os.mkdir(dst_dir) + python_libs = glob.glob( + os.path.join(SOURCE_DIR, "PCBuild", "amd64", "python*.lib") + ) + if python_libs: + for python_lib in python_libs: + shutil.copy(python_lib, dst_dir) # bin + src_dir = os.path.join(SOURCE_DIR, "PCBuild", "amd64") + dst_dir = os.path.join(OUTPUT_DIR, "bin") + shutil.copytree(src_dir, dst_dir) # Create a python3.exe file to mimic Mac+Linux if VARIANT == "Debug": src_python_exe = "python_d.exe" else: src_python_exe = "python.exe" - - src_file = os.path.join(OUTPUT_DIR, src_python_exe) + src_file = os.path.join(src_dir, src_python_exe) dst_file = os.path.join(dst_dir, "python3.exe") - print(f"Copy {src_file} to {dst_file}") shutil.copyfile(src_file, dst_file) - # Move files under root directory into the bin folder. - for filename in os.listdir(os.path.join(OUTPUT_DIR)): - file_path = os.path.join(OUTPUT_DIR, filename) - if os.path.isfile(file_path): - shutil.move(file_path, os.path.join(dst_dir, filename)) - - # Manually move python3.lib because the script provided do not copy it. - python3_lib = "python3.lib" - python3xx_lib = f"python{PYTHON_VERSION}.lib" - - if VARIANT == "Debug": - python3_lib = "python3_d.lib" - python3xx_lib = f"python{PYTHON_VERSION}_d.lib" - - shutil.copy(os.path.join(build_path, python3_lib), os.path.join(dst_dir, python3_lib)) - shutil.copy(os.path.join(build_path, python3xx_lib), os.path.join(dst_dir, python3xx_lib)) - - # Tcl and Tk DLL are not copied by the main.py script in Debug. - # Assuming that Tcl and Tk are not built in debug. - # Manually copy the DLL. - if VARIANT == "Debug": - tcl_dll = os.path.join(build_path, "tcl86t.dll") - tk_dll = os.path.join(build_path, "tk86t.dll") - shutil.copyfile(tcl_dll, os.path.join(dst_dir, "tcl86t.dll")) - shutil.copyfile(tk_dll, os.path.join(dst_dir, "tk86t.dll")) - else: make_args = ["make", "install", f"-j{os.cpu_count() or 1}", "-s"] @@ -753,4 +710,4 @@ def install() -> None: build() if args.install: - install() + install() \ No newline at end of file