Skip to content

Commit f4e5661

Browse files
paulmonzooba
authored andcommitted
bpo-36509: Add iot layout for Windows IoT containers (GH-12663)
This enables using the `--preset-iot` option with the PC/layout script, but does not enable IoT builds as part of any normal release.
1 parent aa25d5d commit f4e5661

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Added preset-iot layout for Windows IoT ARM containers. This layout doesn't
2+
contain UI components like tkinter or IDLE. It also doesn't contain files to
3+
support on-target builds since Windows ARM32 builds must be cross-compiled
4+
when using MSVC.

PC/layout/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@
6666
TOOLS_DIRS = FileNameSet("scripts", "i18n", "pynche", "demo", "parser")
6767
TOOLS_FILES = FileSuffixSet(".py", ".pyw", ".txt")
6868

69+
def copy_if_modified(src, dest):
70+
try:
71+
dest_stat = os.stat(dest)
72+
except FileNotFoundError:
73+
do_copy = True
74+
else:
75+
src_stat = os.stat(src)
76+
do_copy = (src_stat.st_mtime != dest_stat.st_mtime or
77+
src_stat.st_size != dest_stat.st_size)
78+
79+
if do_copy:
80+
shutil.copy2(src, dest)
6981

7082
def get_lib_layout(ns):
7183
def _c(f):
@@ -426,7 +438,7 @@ def copy_files(files, ns):
426438
need_compile.append((dest, ns.copy / dest))
427439
else:
428440
(ns.temp / "Lib" / dest).parent.mkdir(parents=True, exist_ok=True)
429-
shutil.copy2(src, ns.temp / "Lib" / dest)
441+
copy_if_modified(src, ns.temp / "Lib" / dest)
430442
need_compile.append((dest, ns.temp / "Lib" / dest))
431443

432444
if src not in EXCLUDE_FROM_CATALOG:
@@ -436,7 +448,7 @@ def copy_files(files, ns):
436448
log_debug("Copy {} -> {}", src, ns.copy / dest)
437449
(ns.copy / dest).parent.mkdir(parents=True, exist_ok=True)
438450
try:
439-
shutil.copy2(src, ns.copy / dest)
451+
copy_if_modified(src, ns.copy / dest)
440452
except shutil.SameFileError:
441453
pass
442454

PC/layout/support/options.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def public(f):
6363
"props"
6464
],
6565
},
66+
"iot": {
67+
"help": "Windows IoT Core",
68+
"options": ["stable", "pip"],
69+
},
6670
"default": {
6771
"help": "development kit package",
6872
"options": [

0 commit comments

Comments
 (0)