mirror of
https://github.com/apprenticeharper/DeDRM_tools
synced 2024-12-26 09:58:55 +01:00
Generate only one zip file, making the behaviours consistent
This commit is contained in:
parent
e665c47075
commit
5c4eed8f1b
1 changed files with 34 additions and 12 deletions
|
@ -24,7 +24,6 @@ def make_calibre_plugin():
|
|||
contrib_dir = os.path.join(CONTRIB_BASE, 'calibre')
|
||||
|
||||
build_dir = os.path.join(BUILD_BASE, 'DeDRM_calibre_plugin')
|
||||
dist_name = os.path.join(DIST_BASE, 'DeDRM_calibre_plugin')
|
||||
core_dir = os.path.join(build_dir, 'DeDRM_plugin')
|
||||
plugin_name = os.path.join(build_dir, 'DeDRM_plugin')
|
||||
|
||||
|
@ -33,7 +32,6 @@ def make_calibre_plugin():
|
|||
|
||||
shutil.make_archive(plugin_name, 'zip', core_dir)
|
||||
shutil.rmtree(core_dir)
|
||||
return shutil.make_archive(dist_name, 'zip', build_dir)
|
||||
|
||||
|
||||
def make_windows_app():
|
||||
|
@ -41,20 +39,16 @@ def make_windows_app():
|
|||
contrib_dir = os.path.join(CONTRIB_BASE, 'windows')
|
||||
|
||||
build_dir = os.path.join(BUILD_BASE, 'DeDRM_Windows_Application')
|
||||
dist_name = os.path.join(DIST_BASE, 'DeDRM_Windows_Application')
|
||||
core_dir = os.path.join(build_dir, 'DeDRM_App', 'DeDRM_lib', 'lib')
|
||||
|
||||
shutil.copytree(contrib_dir, build_dir)
|
||||
shutil.copytree(SRC_DIR, core_dir)
|
||||
|
||||
return shutil.make_archive(dist_name, 'zip', build_dir)
|
||||
|
||||
|
||||
def make_macos_app():
|
||||
|
||||
contrib_dir = os.path.join(CONTRIB_BASE, 'macos')
|
||||
build_dir = os.path.join(BUILD_BASE, 'DeDRM_Macintosh_Application')
|
||||
dist_name = os.path.join(DIST_BASE, 'DeDRM_Macintosh_Application')
|
||||
core_dir = os.path.join(build_dir, 'DeDRM.app', 'Contents', 'Resources')
|
||||
|
||||
shutil.copytree(contrib_dir, build_dir)
|
||||
|
@ -71,20 +65,48 @@ def make_macos_app():
|
|||
os.path.join(core_dir, name)
|
||||
)
|
||||
|
||||
return shutil.make_archive(dist_name, 'zip', build_dir)
|
||||
|
||||
def make_obok_plugin():
|
||||
|
||||
build_dir = os.path.join(BUILD_BASE, 'Obok_calibre_plugin')
|
||||
core_dir = os.path.join(build_dir, 'obok_plugin')
|
||||
plugin_name = os.path.join(build_dir, 'obok_plugin')
|
||||
|
||||
shutil.copytree('Obok_calibre_plugin', build_dir)
|
||||
shutil.make_archive(plugin_name, 'zip', core_dir)
|
||||
|
||||
|
||||
def make_all():
|
||||
def make_misc():
|
||||
|
||||
for name in ('Other_Tools',):
|
||||
shutil.copytree(name, os.path.join(BUILD_BASE, name))
|
||||
for name in ('FAQs.md', 'README.md', 'ReadMe_First.txt',):
|
||||
shutil.copy2(name, os.path.join(BUILD_BASE, name))
|
||||
|
||||
|
||||
def make_release(version):
|
||||
|
||||
try:
|
||||
shutil.rmtree(BUILD_BASE)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
print(make_calibre_plugin())
|
||||
print(make_windows_app())
|
||||
print(make_macos_app())
|
||||
make_calibre_plugin()
|
||||
make_windows_app()
|
||||
make_macos_app()
|
||||
make_obok_plugin()
|
||||
make_misc()
|
||||
|
||||
release_name = 'DeDRM_tools_{}'.format(version)
|
||||
release_path = os.path.join(DIST_BASE, release_name)
|
||||
return shutil.make_archive(release_path, 'zip', BUILD_BASE)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_all()
|
||||
import sys
|
||||
try:
|
||||
version = sys.argv[1]
|
||||
except IndexError:
|
||||
raise SystemExit('Usage: {} version'.format(__file__))
|
||||
|
||||
print(make_release(version))
|
||||
|
|
Loading…
Reference in a new issue