Skip to content

Commit

Permalink
After compiling packages, save them into a release zip
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Jan 6, 2016
1 parent 516a850 commit 4a90550
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions compile_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,21 @@ def clean_text(file_path):
DELETE_EXTENSIONS = ['vmx', 'log', 'bsp', 'prt', 'lin']


def do_folder(zip_path, path):
def do_folder(zip_path, path, pack_list):
for package in os.listdir(path):
package_path = os.path.join(path, package)
if not os.path.isdir(package_path):
continue

if 'info.txt' not in os.listdir(package_path):
do_folder(zip_path, package_path)
do_folder(zip_path, package_path, pack_list)
continue

print('| ' + package + '.zip')
pack_zip_path = os.path.join(zip_path, package)


pack_list.append(pack_zip_path + '.zip')

zip_file = ZipFile(
pack_zip_path + '.zip',
'w',
Expand Down Expand Up @@ -136,7 +138,6 @@ def main():
os.getcwd(),
'zips',
'sml' if OPTIMISE else 'lrg',
'packages/',
)
if os.path.isdir(zip_path):
for file in os.listdir(zip_path):
Expand All @@ -146,7 +147,18 @@ def main():
os.makedirs(zip_path)

path = os.path.join(os.getcwd(), 'packages\\', )
do_folder(zip_path, path)

packages = [] # A list of all the package zips.

do_folder(zip_path, path, packages)

print('Building main zip...')

with ZipFile(os.path.join('zips', 'packages.zip'), 'w', compression=ZIP_LZMA,) as zip_file:
for file in os.listdir(zip_path):
zip_file.write(os.path.join(zip_path, file), os.path.join('packages/', file))
print('.', end='', flush=True)
print('Done!')

if __name__ == '__main__':
main()

0 comments on commit 4a90550

Please sign in to comment.