Skip to content
Snippets Groups Projects
Commit 6912410e authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Convert installation scripts to Python

parent d26e1513
No related branches found
No related tags found
No related merge requests found
import os
import shutil
def main():
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.system("pip install certifi")
print "Copying certifi's cacert.pem"
import certifi
shutil.copy2(certifi.where(), 'agkyra/resources/cacert.pem')
if __name__ == '__main__':
main()
#!/usr/bin/env bash
# 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/>.
CURPWD=$(pwd)
cd "$(dirname "$0")"
ROOTDIR=$(pwd)
pip install certifi
echo "Copying certifi's cacert.pem"
python -c "import certifi; import shutil; shutil.copy2(certifi.where(), 'agkyra/resources/cacert.pem')"
import os
def main():
os.chdir(os.path.dirname(os.path.realpath(__file__)))
# this is needed for mock
os.system("pip install --upgrade setuptools")
import get_nwjs
get_nwjs.main()
import cacert_cp
cacert_cp.main()
print "Now run 'python setup.py install'."
if __name__ == '__main__':
main()
#!/bin/bash
# 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/>.
CURPWD=$(pwd)
cd "$(dirname "$0")"
ROOTPATH=$(pwd)
# this is needed for mock
pip install --upgrade setuptools
./get_nwjs.sh $1
if [ $? -ne 0 ]; then
exit 1
fi
./cacert_cp.sh
if [ $? -ne 0 ]; then
exit 1
fi
echo "Now run 'python setup.py install'."
import os
import sys
import shutil
import urllib
VERSION="v0.12.3"
nwjsfile = {
"win64": "nwjs-%s-win-x64.zip",
"osx64": "nwjs-%s-osx-x64.zip",
"linux64": "nwjs-%s-linux-x64.tar.gz",
"win32": "nwjs-%s-win-ia32.zip",
"osx32" : "nwjs-%s-osx-ia32.zip",
"linux32": "nwjs-%s-linux-ia32.tar.gz",
}
def main():
os.chdir(os.path.dirname(os.path.realpath(__file__)))
if len(sys.argv) < 2:
print "Select one of: %s" % " ".join(nwjsfile.keys())
exit(1)
osarg = sys.argv[1]
filename = nwjsfile[osarg] % VERSION
url = "http://dl.nwjs.io/%s/%s" % (VERSION, filename)
print "Will first download nwjs."
target = "agkyra/resources/nwjs"
if os.path.isdir(target):
print "Warning: cleaning up %s." % target
shutil.rmtree(target)
elif os.path.exists(target):
print "%s exists and is not a dir; aborting." % target
exit(1)
print "Retrieving %s" % url
urllib.urlretrieve(url, filename)
print "Extracting %s" % filename
if osarg.startswith("linux"):
toplevel = filename.strip('.tar.gz')
os.system("tar xzf %s" % filename)
print "Renaming %s to %s" % (toplevel, target)
os.rename(toplevel, target)
else:
toplevel = filename.strip('.zip')
if osarg.startswith('osx'):
os.system("unzip %s" % filename)
else: # Windows has no unzip command
import zipfile
with zipfile.ZipFile(filename, "r") as z:
z.extractall('.')
print "Renaming %s to %s" % (toplevel, target)
os.rename(toplevel, target)
print "Deleting %s" % filename
os.unlink(filename)
if __name__ == "__main__":
main()
#!/usr/bin/env bash
# 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/>.
VERSION="v0.12.3"
CURPWD=$(pwd)
cd "$(dirname "$0")"
ROOTDIR=$(pwd)
declare -A nwjsfile
nwjsfile[win64]="nwjs-${VERSION}-win-x64.zip"
nwjsfile[osx64]="nwjs-${VERSION}-osx-x64.zip"
nwjsfile[linux64]="nwjs-${VERSION}-linux-x64.tar.gz"
nwjsfile[win32]="nwjs-${VERSION}-win-ia32.zip"
nwjsfile[osx32]="nwjs-${VERSION}-osx-ia32.zip"
nwjsfile[linux32]="nwjs-${VERSION}-linux-ia32.tar.gz"
if [[ -z $1 ]]; then
echo "Select one of:" ${!nwjsfile[@]}
exit 1
fi
os=$1
file=${nwjsfile[$os]}
url="http://dl.nwjs.io/${VERSION}/"$file
echo "Will first download nwjs."
AGKPATH=agkyra
NWJSPATH=$AGKPATH/resources/nwjs
if [ -d $NWJSPATH ]; then
echo "Warning: cleaning up $NWJSPATH."
rm -r $NWJSPATH
fi
mkdir $NWJSPATH
wget $url
if [[ "$os" =~ ^(linux64|linux32)$ ]]; then
tar xzf $file --strip-components 1 -C $NWJSPATH
else
unzip -d tmpnwjs $file && mv tmpnwjs/*/* $NWJSPATH && rm -r tmpnwjs
fi
rm $file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment