]> granicus.if.org Git - python/commitdiff
bpo-36509: Add iot layout for Windows IoT containers (GH-12663)
authorPaul Monson <paulmon@users.noreply.github.com>
Fri, 12 Apr 2019 16:55:57 +0000 (09:55 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Fri, 12 Apr 2019 16:55:57 +0000 (09:55 -0700)
This enables using the `--preset-iot` option with the PC/layout script, but does not enable IoT builds as part of any normal release.

Misc/NEWS.d/next/Windows/2019-04-02-10-11-18.bpo-36509.DdaM67.rst [new file with mode: 0644]
PC/layout/main.py
PC/layout/support/options.py

diff --git a/Misc/NEWS.d/next/Windows/2019-04-02-10-11-18.bpo-36509.DdaM67.rst b/Misc/NEWS.d/next/Windows/2019-04-02-10-11-18.bpo-36509.DdaM67.rst
new file mode 100644 (file)
index 0000000..722f763
--- /dev/null
@@ -0,0 +1,4 @@
+Added preset-iot layout for Windows IoT ARM containers. This layout doesn't
+contain UI components like tkinter or IDLE. It also doesn't contain files to
+support on-target builds since Windows ARM32 builds must be cross-compiled
+when using MSVC.
index 185e6498e1bc3857333bc6e2668e5f1da90ad784..624033e721b73a699e7dcbe12ecab2969dd5093e 100644 (file)
@@ -66,6 +66,18 @@ DATA_DIRS = FileNameSet("data")
 TOOLS_DIRS = FileNameSet("scripts", "i18n", "pynche", "demo", "parser")
 TOOLS_FILES = FileSuffixSet(".py", ".pyw", ".txt")
 
+def copy_if_modified(src, dest):
+    try:
+        dest_stat = os.stat(dest)
+    except FileNotFoundError:
+        do_copy = True
+    else:
+        src_stat = os.stat(src)
+        do_copy = (src_stat.st_mtime != dest_stat.st_mtime or
+                   src_stat.st_size != dest_stat.st_size)
+
+    if do_copy:
+        shutil.copy2(src, dest)
 
 def get_lib_layout(ns):
     def _c(f):
@@ -426,7 +438,7 @@ def copy_files(files, ns):
                     need_compile.append((dest, ns.copy / dest))
                 else:
                     (ns.temp / "Lib" / dest).parent.mkdir(parents=True, exist_ok=True)
-                    shutil.copy2(src, ns.temp / "Lib" / dest)
+                    copy_if_modified(src, ns.temp / "Lib" / dest)
                     need_compile.append((dest, ns.temp / "Lib" / dest))
 
             if src not in EXCLUDE_FROM_CATALOG:
@@ -436,7 +448,7 @@ def copy_files(files, ns):
                 log_debug("Copy {} -> {}", src, ns.copy / dest)
                 (ns.copy / dest).parent.mkdir(parents=True, exist_ok=True)
                 try:
-                    shutil.copy2(src, ns.copy / dest)
+                    copy_if_modified(src, ns.copy / dest)
                 except shutil.SameFileError:
                     pass
 
index 22492f220d606e6bae507045b7a5d52617e96714..00f05667ebb7afcd0f518d4afe4ba34beb2b89d1 100644 (file)
@@ -63,6 +63,10 @@ PRESETS = {
             "props"
         ],
     },
+    "iot": {
+        "help": "Windows IoT Core",
+        "options": ["stable", "pip"],
+    },
     "default": {
         "help": "development kit package",
         "options": [