Skip to content

Commit 4498f5f

Browse files
committed
Add argument to enhance portability: --group
1 parent 16385e6 commit 4498f5f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

build_docs.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def shell_out(cmd):
6464

6565

6666
def build_one(version, isdev, quick, sphinxbuild, build_root, www_root,
67-
skip_cache_invalidation=False):
67+
skip_cache_invalidation=False, group='docs'):
6868
checkout = build_root + "/python" + str(version).replace('.', '')
6969
target = www_root + "/" + str(version)
7070
logging.info("Doc autobuild started in %s", checkout)
@@ -92,16 +92,16 @@ def build_one(version, isdev, quick, sphinxbuild, build_root, www_root,
9292
changed.append(rel_path)
9393

9494
logging.info("Copying HTML files to %s", target)
95-
shell_out("chown -R :docs Doc/build/html/")
95+
shell_out("chown -R :{} Doc/build/html/".format(group))
9696
shell_out("chmod -R o+r Doc/build/html/")
9797
shell_out("find Doc/build/html/ -type d -exec chmod o+x {} ';'")
9898
shell_out("cp -a Doc/build/html/* %s" % target)
9999
if not quick:
100100
logging.debug("Copying dist files")
101-
shell_out("chown -R :docs Doc/dist/")
101+
shell_out("chown -R :{} Doc/dist/".format(group))
102102
shell_out("chmod -R o+r Doc/dist/")
103103
shell_out("mkdir -m o+rx -p %s/archives" % target)
104-
shell_out("chown :docs %s/archives" % target)
104+
shell_out("chown :{} {}/archives".format(group, target))
105105
shell_out("cp -a Doc/dist/* %s/archives" % target)
106106
changed.append("archives/")
107107
for fn in os.listdir(os.path.join(target, "archives")):
@@ -172,6 +172,10 @@ def parse_args():
172172
"--skip-cache-invalidation",
173173
help="Skip fastly cache invalidation.",
174174
action="store_true")
175+
parser.add_argument(
176+
"--group",
177+
help="Group files on targets and www-root file should get.",
178+
default="docs")
175179
return parser.parse_args()
176180

177181

@@ -189,12 +193,13 @@ def parse_args():
189193
if args.branch:
190194
build_one(args.branch, args.devel, args.quick, sphinxbuild,
191195
args.build_root, args.www_root,
192-
args.skip_cache_invalidation)
196+
args.skip_cache_invalidation,
197+
args.group)
193198
else:
194199
for version, devel in BRANCHES:
195200
build_one(version, devel, args.quick, sphinxbuild,
196201
args.build_root, args.www_root,
197-
args.skip_cache_invalidation)
202+
args.skip_cache_invalidation, args.group)
198203
build_devguide(args.devguide_checkout, args.devguide_target,
199204
sphinxbuild, args.skip_cache_invalidation)
200205
except Exception:

0 commit comments

Comments
 (0)