From ddcd8a10d189b67331fe7a5e1116b87dcea00b08 Mon Sep 17 00:00:00 2001 From: Giorgos Korfiatis <gkorf@grnet.gr> Date: Wed, 7 Oct 2015 17:19:13 +0300 Subject: [PATCH] make a final archive --- README.md | 2 ++ bundle.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 bundle.py diff --git a/README.md b/README.md index 7d0a18a..cb9ad1b 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ the Python framework can be created with PyInstaller. '/usr/lib/libsqlite3.dylib' '@loader_path/libsqlite3.dylib' _sqlite3.so` +4. Make an archive (zip, or gzipped tar) with `python bundle.py <platform>`. + ## Copyright and license Copyright (C) 2015 GRNET S.A. diff --git a/bundle.py b/bundle.py new file mode 100644 index 0000000..de99382 --- /dev/null +++ b/bundle.py @@ -0,0 +1,61 @@ +# Copyright (C) 2015 GRNET S.A. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +import os +import sys +import shutil +import agkyra + +DISTPATH = 'dist' + +OS_OPTIONS = [ + "win64", + "osx64", + "linux64", + "win32", + "osx32", + "linux32", +] + + +def main(): + os.chdir(os.path.dirname(os.path.realpath(__file__))) + + if len(sys.argv) < 2 or sys.argv[1] not in OS_OPTIONS: + print "Select one of: %s" % " ".join(OS_OPTIONS) + exit(1) + + osarg = sys.argv[1] + version = agkyra.__version__ + + os.chdir(DISTPATH) + filename = 'agkyra-%s-%s' % (version, osarg) + if osarg.startswith("linux"): + arch_type = 'gztar' + base_dir = 'agkyra' + elif osarg.startswith('osx'): + arch_type = 'zip' + base_dir = 'agkyra.app' + elif osarg.startswith('win'): + arch_type = 'zip' + base_dir = 'agkyra' + + arch_name = shutil.make_archive( + filename, arch_type, root_dir='.', base_dir=base_dir) + print "Wrote %s" % os.path.join(DISTPATH, arch_name) + +if __name__ == "__main__": + main() -- GitLab