mirror of
https://github.com/apprenticeharper/DeDRM_tools
synced 2024-12-27 09:58:59 +01:00
afa4ac5716
THIS IS ON THE MASTER BRANCH. The Master branch will be Python 3.0 from now on. While Python 2.7 support will not be deliberately broken, all efforts should now focus on Python 3.0 compatibility. I can see a lot of work has been done. There's more to do. I've bumped the version number of everything I came across to the next major number for Python 3.0 compatibility indication. Thanks everyone. I hope to update here at least once a week until we have a stable 7.0 release for calibre 5.0
66 lines
1.6 KiB
Python
Executable file
66 lines
1.6 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# code: utf-8
|
|
|
|
'''
|
|
A wrapper script to generate zip files for GitHub releases.
|
|
|
|
This script tends to be compatible with both Python 2 and Python 3.
|
|
'''
|
|
|
|
from __future__ import print_function
|
|
|
|
import os
|
|
import shutil
|
|
|
|
|
|
DEDRM_SRC_DIR = 'DeDRM_plugin'
|
|
DEDRM_README= 'DeDRM_plugin_ReadMe.txt'
|
|
OBOK_SRC_DIR = 'Obok_plugin'
|
|
OBOK_README = 'obok_plugin_ReadMe.txt'
|
|
RELEASE_DIR = 'release'
|
|
|
|
def make_calibre_plugin():
|
|
|
|
shutil.make_archive(core_dir, 'zip', core_dir)
|
|
shutil.rmtree(core_dir)
|
|
|
|
|
|
def make_obok_plugin():
|
|
obok_plugin_dir = os.path.join(SHELLS_BASE, 'Obok_calibre_plugin')
|
|
core_dir = os.path.join(obok_plugin_dir, 'obok_plugin')
|
|
|
|
shutil.copytree(OBOK_SRC_DIR, core_dir)
|
|
shutil.make_archive(core_dir, 'zip')
|
|
shutil.rmtree(core_dir)
|
|
|
|
def make_release(version):
|
|
try:
|
|
shutil.rmtree(RELEASE_DIR)
|
|
except:
|
|
pass
|
|
os.mkdir(RELEASE_DIR)
|
|
shutil.make_archive(DEDRM_SRC_DIR, 'zip', DEDRM_SRC_DIR)
|
|
shutil.make_archive(OBOK_SRC_DIR, 'zip', OBOK_SRC_DIR)
|
|
shutil.move(DEDRM_SRC_DIR+'.zip', RELEASE_DIR)
|
|
shutil.move(OBOK_SRC_DIR+'.zip', RELEASE_DIR)
|
|
shutil.copy(DEDRM_README, RELEASE_DIR)
|
|
shutil.copy(OBOK_README, RELEASE_DIR)
|
|
shutil.copy("ReadMe_Overview.txt", RELEASE_DIR)
|
|
|
|
release_name = 'DeDRM_tools_{}'.format(version)
|
|
result = shutil.make_archive(release_name, 'zip', RELEASE_DIR)
|
|
try:
|
|
shutil.rmtree(RELEASE_DIR)
|
|
except:
|
|
pass
|
|
return result
|
|
|
|
|
|
if __name__ == '__main__':
|
|
import sys
|
|
try:
|
|
version = sys.argv[1]
|
|
except IndexError:
|
|
raise SystemExit('Usage: {} version'.format(__file__))
|
|
|
|
print(make_release(version))
|