Skip to content

Commit e1dcdfc

Browse files
authored
Remove subprocess calls for copying archive files (#292)
1 parent 6164fac commit e1dcdfc

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.github/workflows/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ jobs:
3939
--languages en
4040
--branches 3.14
4141
42+
- name: Upload documentation
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: www-root
46+
path: ./www
47+
4248
unit:
4349
name: Unit tests
4450
runs-on: ${{ matrix.os }}

build_docs.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -756,22 +756,23 @@ def copy_build_to_webroot(self, http: urllib3.PoolManager) -> None:
756756
target,
757757
])
758758

759-
if not self.quick and (self.checkout / "Doc" / "dist").is_dir():
759+
dist_dir = self.checkout / "Doc" / "dist"
760+
if dist_dir.is_dir():
760761
# Copy archive files to /archives/
761762
logging.debug("Copying dist files.")
762-
chgrp(self.checkout / "Doc" / "dist", group=self.group, recursive=True)
763-
chmod_make_readable(self.checkout / "Doc" / "dist")
764-
run(["mkdir", "-m", "o+rx", "-p", target / "archives"])
765-
chgrp(target / "archives", group=self.group)
766-
run([
767-
"cp",
768-
"-a",
769-
*(self.checkout / "Doc" / "dist").glob("*"),
770-
target / "archives",
771-
])
763+
chgrp(dist_dir, group=self.group, recursive=True)
764+
chmod_make_readable(dist_dir)
765+
archives_dir = target / "archives"
766+
archives_dir.mkdir(parents=True, exist_ok=True)
767+
archives_dir.chmod(
768+
archives_dir.stat().st_mode | stat.S_IROTH | stat.S_IXOTH
769+
)
770+
chgrp(archives_dir, group=self.group)
771+
for dist_file in dist_dir.iterdir():
772+
shutil.copy2(dist_file, archives_dir / dist_file.name)
772773
changed.append("archives/")
773-
for file in (target / "archives").iterdir():
774-
changed.append("archives/" + file.name)
774+
for file in archives_dir.iterdir():
775+
changed.append(f"archives/{file.name}")
775776

776777
logging.info("%s files changed", len(changed))
777778
if changed and not self.skip_cache_invalidation:

0 commit comments

Comments
 (0)