Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import os
  2. import shutil
  3. def get_version():
  4. with open('package.json') as f:
  5. for line in f.readlines():
  6. if '"version":' in line:
  7. return line.split('"')[-2]
  8. def zip_folder(folder, name, format='zip'):
  9. print('zip %s into %s compressed file' % (folder, name))
  10. shutil.make_archive(name, format, '.', folder)
  11. print('remove %s folder' % folder)
  12. shutil.rmtree(folder)
  13. def move(zip_name):
  14. print('move %s into build folder' % zip_name)
  15. shutil.move(zip_name, os.path.join(build_folder, zip_name))
  16. build_folder = 'build'
  17. if os.path.exists(build_folder):
  18. shutil.rmtree(build_folder)
  19. os.makedirs(build_folder)
  20. # windows
  21. windows_folder = 'LessPass-win32-x64'
  22. if os.path.exists(windows_folder):
  23. basename = 'LessPass-v%s.win32-x64' % get_version()
  24. filename = '%s.zip' % basename
  25. zip_folder(windows_folder, basename, 'zip')
  26. move(filename)
  27. # linux
  28. linux_folder = 'LessPass-linux-x64'
  29. if os.path.exists(linux_folder):
  30. basename = 'LessPass-v%s.linux-x64' % get_version()
  31. filename = '%s.tar.gz' % basename
  32. zip_folder(linux_folder, basename, 'gztar')
  33. move(filename)