scripts/install.py

branch
eric7
changeset 10743
5d3a5a05114e
parent 10716
11cdcc824469
child 10781
0e3d6e22efaf
diff -r 7aa41173b44b -r 5d3a5a05114e scripts/install.py
--- a/scripts/install.py	Thu Jun 06 18:01:54 2024 +0200
+++ b/scripts/install.py	Fri Jun 07 10:05:06 2024 +0200
@@ -30,8 +30,6 @@
 import sysconfig
 import time
 
-from functools import partial
-
 # Define the globals.
 currDir = os.getcwd()
 modDir = None
@@ -1907,97 +1905,6 @@
     print()
 
 
-def __pyName(py_dir, py_file):
-    """
-    Local function to create the Python source file name for the compiled
-    .ui file.
-
-    @param py_dir suggested name of the directory
-    @type str
-    @param py_file suggested name for the compile source file
-    @type str
-    @return tuple of directory name and source file name
-    @rtype tuple of (str, str)
-    """
-    return py_dir, "Ui_{0}".format(py_file)
-
-
-def __compileOneUi(ui_path, mapFunc=None):
-    """
-    Function to compile a single form file to Python code.
-
-    @param ui_path path of the Qt form file
-    @type str
-    @param mapFunc function to change directory and/or name of the resulting Python file
-        (defaults to None)
-    @type func (optional)
-    """
-    from PyQt6.uic import compileUi  # noqa: I102
-
-    py_dir, py_file = os.path.split(ui_path[:-3] + ".py")
-
-    # Allow the caller to change the name of the .py file or generate
-    # it in a different directory.
-    if mapFunc is not None:
-        py_dir, py_file = mapFunc(py_dir, py_file)
-
-    # Make sure the destination directory exists.
-    os.makedirs(py_dir, exist_ok=True)
-
-    py_path = os.path.join(py_dir, py_file)
-
-    with open(py_path, "w", encoding="utf-8") as py_file:
-        compileUi(ui_path, py_file, execute=False, indent=4)
-
-
-def compileUiDir(root, recurse=False, mapFunc=None, workers=1):
-    """
-    Function to compile all Qt form files of a directory or directory tree
-    to Python code.
-
-    @param root directory to scan for Qt form files (i.e. files ending with '.ui'
-    @type str
-    @param recurse flag indicating to recurse into sub-directories (defaults to False)
-    @type bool (optional)
-    @param mapFunc function to change directory and/or name of the resulting Python file
-        (defaults to None)
-    @type func (optional)
-    @param workers number of worker processes to be used to compile (defaults to 1)
-    @type int (optional)
-    """
-    if recurse:
-        ui_files = []
-        for rootDir, _, files in os.walk(root):
-            ui_files.extend(
-                os.path.join(rootDir, ui) for ui in files if ui.endswith(".ui")
-            )
-    else:
-        ui_files = [
-            os.path.join(root, ui)
-            for ui in os.listdir(root)
-            if os.path.isfile(os.path.join(root, ui) and ui.endswith(".ui"))
-        ]
-
-    ProcessPoolExecutor = None
-    if workers != 1:
-        try:
-            from concurrent.futures import ProcessPoolExecutor  # noqa: I101, I103
-        except NotImplementedError:
-            workers = 1
-
-    if workers != 1 and ProcessPoolExecutor is not None:
-        # If workers == 0, let ProcessPoolExecutor determine worker count.
-        workers = workers or None
-        with ProcessPoolExecutor(max_workers=workers) as executor:
-            executor.map(
-                partial(__compileOneUi, mapFunc=mapFunc),
-                ui_files,
-            )
-    else:
-        for ui_file in ui_files:
-            __compileOneUi(ui_file, mapFunc=mapFunc)
-
-
 def prepareInfoFile(fileName):
     """
     Function to prepare an Info.py file when installing from source.
@@ -2413,16 +2320,6 @@
     createInstallInfo()
     print(" Done")
 
-    # Compile .ui files
-    print("Compiling user interface files ...", end="", flush=True)
-    # step 1: remove old Ui_*.py files
-    for root, _, files in os.walk(sourceDir):
-        for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]:
-            os.remove(os.path.join(root, file))
-    # step 2: compile the forms
-    compileUiDir(eric7SourceDir, recurse=True, mapFunc=__pyName, workers=0)
-    print(" Done")
-
     if doCompile:
         print("Compiling source files ...", end="", flush=True)
         skipRe = re.compile(r"DebugClients[\\/]Python[\\/]")

eric ide

mercurial