mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
docs: create sources tarball
maintainer-scripts/ChangeLog: * update_web_docs_git.py: Create sources tarball.
This commit is contained in:
parent
4eadbe8006
commit
52eedc1fa3
@ -37,6 +37,32 @@ def find_configs():
|
||||
yield (Path(root).resolve(), docname)
|
||||
|
||||
|
||||
def create_source_tarball(output, configs):
|
||||
pwd = Path('.').resolve()
|
||||
subfolders = {'doc'}
|
||||
explicit_files = {'gcc/BASE-VER', 'gcc/DEV-PHASE', 'gcc/DATESTAMP'}
|
||||
|
||||
for location, _ in configs:
|
||||
location = location.relative_to(pwd)
|
||||
while not location.name == 'doc':
|
||||
location = location.parent
|
||||
subfolders.add(location)
|
||||
|
||||
sources = Path('sources')
|
||||
sources.mkdir()
|
||||
|
||||
# Copy all subfolders and files
|
||||
for subfolder in subfolders:
|
||||
shutil.copytree(subfolder, sources / subfolder)
|
||||
|
||||
for filename in explicit_files:
|
||||
shutil.copy(filename, sources / filename)
|
||||
|
||||
shutil.make_archive(Path(output, 'docs-sources'), 'gztar',
|
||||
sources)
|
||||
print('sources tarball has been created')
|
||||
|
||||
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
print(f'Using {folder} as temporary directory')
|
||||
os.chdir(folder)
|
||||
@ -49,6 +75,9 @@ with tempfile.TemporaryDirectory() as folder:
|
||||
if not output.exists():
|
||||
output.mkdir()
|
||||
|
||||
# Create source tarball
|
||||
create_source_tarball(output, configs)
|
||||
|
||||
temp = Path('tmp').resolve()
|
||||
temp.mkdir()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user