Bug 1855360 - Fix the skip-if syntax. a=bustage-fix
[gecko.git] / tools / moztreedocs / package.py
blobb8db23ee879bfc2991acf8d93211d6c4b1e3738b
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, # You can obtain one at http://mozilla.org/MPL/2.0/.
5 import os
7 from mozpack.archive import create_tar_gz_from_files
8 from mozpack.files import FileFinder
11 def distribution_files(root):
12 """Find all files suitable for distributing.
14 Given the path to generated Sphinx documentation, returns an iterable
15 of (path, BaseFile) for files that should be archived, uploaded, etc.
16 Paths are relative to given root directory.
17 """
18 finder = FileFinder(root, ignore=("_staging", "_venv"))
19 return finder.find("**")
22 def create_tarball(filename, root):
23 """Create a tar.gz archive of docs in a directory."""
24 files = dict(distribution_files(root))
26 with open(filename, "wb") as fh:
27 create_tar_gz_from_files(
28 fh, files, filename=os.path.basename(filename), compresslevel=6