Add python3 support

This commit is contained in:
Safa Ariman
2019-06-06 01:31:19 +03:00
parent 68344a2d87
commit c90351220c
146 changed files with 806 additions and 1082 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ installdb = pisi.db.installdb.InstallDB()
def ask_action(msg, actions, default):
while True:
s = raw_input(msg)
s = eval(input(msg))
if len(s) == 0:
return default
else:
@@ -35,8 +35,8 @@ def get_installed_packages():
def check_changed_config_files(package):
all_files = installdb.get_files(package)
config_files = filter(lambda x: x.type == 'config', all_files.list)
config_paths = map(lambda x: "/" + str(x.path), config_files)
config_files = [x for x in all_files.list if x.type == 'config']
config_paths = ["/" + str(x.path) for x in config_files]
newconfig = []
for path in config_paths:
@@ -75,7 +75,7 @@ def check_changes():
if __name__ == "__main__":
if len(sys.argv) == 1:
print "Checking all packages"
print("Checking all packages")
check_changes()
if len(sys.argv) == 2:
check_package(sys.argv[1])
+3 -3
View File
@@ -35,7 +35,7 @@ if __name__ == "__main__":
try:
packages = scanPSPEC(sys.argv[1])
except:
print "Usage: cleanArchives.py path2repo"
print("Usage: cleanArchives.py path2repo")
sys.exit(1)
if "--dry-run" in sys.argv:
@@ -54,10 +54,10 @@ if __name__ == "__main__":
files.append(URI.filename())
archiveFiles = os.listdir("/var/cache/pisi/archives/")
unneededFiles = filter(lambda x:x not in files, archiveFiles)
unneededFiles = [x for x in archiveFiles if x not in files]
for i in unneededFiles:
if not clean:
print("/var/cache/pisi/archives/%s" % i)
print(("/var/cache/pisi/archives/%s" % i))
else:
cleanArchives("/var/cache/pisi/archives/%s" % i)
+6 -6
View File
@@ -23,7 +23,7 @@ def findUnneededFiles(listdir):
for f in listdir:
try:
name, version = util.parse_package_name(f)
if dict.has_key(name):
if name in dict:
if Version(dict[name]) < Version(version):
dict[name] = version
else:
@@ -42,20 +42,20 @@ def doit(root, listdir, clean, suffix = ""):
for f in listdir:
target = os.path.join(root, "%s%s" % (f, suffix))
if os.path.exists(target):
print "%s%s" % (f, suffix)
print(("%s%s" % (f, suffix)))
if clean == True:
try:
if os.path.isdir(target):
shutil.rmtree(target)
else:
os.remove(target)
except OSError,e :
except OSError as e :
usage("Permission denied: %s" % e)
def cleanPisis(clean, root = '/var/cache/pisi/packages'):
# pisi packages
list = map(lambda x: os.path.basename(x).split(".pisi")[0], glob.glob("%s/*.pisi" % root))
list = [os.path.basename(x).split(".pisi")[0] for x in glob.glob("%s/*.pisi" % root)]
list.sort()
l = findUnneededFiles(list)
doit(root, l, clean, ".pisi")
@@ -71,13 +71,13 @@ def cleanBuilds(clean, root = '/var/pisi'):
doit(root, l, clean)
def usage(msg):
print """
print(("""
Error: %s
Usage:
cleanCache --dry-run (Shows unneeded files)
cleanCache --clean (Removes unneeded files)
""" % msg
""" % msg))
sys.exit(1)
+4 -4
View File
@@ -19,7 +19,7 @@ from pisi.delta import create_delta_package
def minsandmaxes():
packages = map(lambda x: os.path.basename(x).split(".pisi")[0], set(glob.glob("*.pisi")) - set(glob.glob("*.delta.pisi")))
packages = [os.path.basename(x).split(".pisi")[0] for x in set(glob.glob("*.pisi")) - set(glob.glob("*.delta.pisi"))]
versions = {}
for file in packages:
@@ -28,7 +28,7 @@ def minsandmaxes():
mins = {}
maxs = {}
for pkg in versions.keys():
for pkg in list(versions.keys()):
mins[pkg] = min(versions[pkg])
maxs[pkg] = max(versions[pkg])
@@ -37,7 +37,7 @@ def minsandmaxes():
if __name__ == "__main__":
mi, ma = minsandmaxes()
for pkg in mi.keys():
for pkg in list(mi.keys()):
old_pkg = "%s-%s.pisi" % (pkg, str(mi[pkg]))
new_pkg = "%s-%s.pisi" % (pkg, str(ma[pkg]))
name, version = util.parse_package_name(pkg)
@@ -46,5 +46,5 @@ if __name__ == "__main__":
# skip if same
if not os.path.exists("%s-%s-%s.delta.pisi" % (name, str(mi[pkg].build), str(ma[pkg].build))):
# skip if delta exists
print "%s --> Min: %s Max: %s \n %s-%s-%s.delta.pisi" % (pkg, old_pkg, new_pkg, name, str(mi[pkg].build), str(ma[pkg].build))
print(("%s --> Min: %s Max: %s \n %s-%s-%s.delta.pisi" % (pkg, old_pkg, new_pkg, name, str(mi[pkg].build), str(ma[pkg].build))))
create_delta_package(old_pkg, new_pkg)
+2 -2
View File
@@ -56,6 +56,6 @@ def findMetadata():
for file in findMetadata():
if saveMetadata(fixMetadata(file), file):
print "Güncellendi : ", file
print(("Güncellendi : ", file))
else:
print "Hiç bir şey yapılmadı: ", file
print(("Hiç bir şey yapılmadı: ", file))
+5 -5
View File
@@ -26,13 +26,13 @@ def uniq(alist):
return [set.setdefault(e, e) for e in alist if e not in set]
def usage(errmsg):
print """
print("""
Error: %s
Usage:
lspisi PiSi_package.PiSi (lists the content of package)
lspisi dirs PiSi_package.PiSi (lists directories in the package for the package developer)
""" % (errmsg)
""" % (errmsg))
sys.exit(1)
@@ -47,14 +47,14 @@ def main():
dirlist.append(os.path.dirname(file))
for dir in uniq(dirlist):
print "<Path fileType=\"\">/%s</Path>" % dir
print("<Path fileType=\"\">/%s</Path>" % dir)
elif not os.path.exists(sys.argv[1]):
print "File %s not found" % sys.argv[1]
print("File %s not found" % sys.argv[1])
else:
for file in show_info(sys.argv[1]):
print "/%s" % file
print("/%s" % file)
if __name__ == "__main__":
sys.exit(main())
+2 -2
View File
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os
import urllib2
import urllib.request, urllib.error, urllib.parse
import piksemel
@@ -12,7 +12,7 @@ authors = {}
def get_author_name_mail(author):
if not authors:
accounts = urllib2.urlopen(accounts_url)
accounts = urllib.request.urlopen(accounts_url)
for line in accounts:
if line.startswith("#"):
continue
+7 -7
View File
@@ -175,11 +175,11 @@ temp_translation = '''<?xml version="1.0" ?>
def write(filename, data):
try:
f = file("%s/%s" % (target, filename), "w")
f = open("%s/%s" % (target, filename), "w")
f.write(data)
f.close()
except:
print "Could not write file %s/%s" % (target, filename)
print("Could not write file %s/%s" % (target, filename))
def create_dirs():
@@ -187,7 +187,7 @@ def create_dirs():
os.makedirs("%s/files" % target)
os.makedirs("%s/comar" % target)
except:
print "Could not make directory %s" % target
print("Could not make directory %s" % target)
sys.exit(1)
def readConfig():
@@ -196,7 +196,7 @@ def readConfig():
d = {"name": "", "email": ""}
if home != "" and os.path.exists(cfg):
for line in file(cfg):
for line in open(cfg):
if line != "" and not line.startswith("#") and "=" in line:
l, m = line.split("=", 1)
k = l.strip()
@@ -210,7 +210,7 @@ def readConfig():
# some checks
if len(sys.argv) < 2:
print "Usage : %s NewPackageDir" % sys.argv[0]
print("Usage : %s NewPackageDir" % sys.argv[0])
sys.exit(0)
else:
target = sys.argv[1]
@@ -218,10 +218,10 @@ else:
data["package_cap"] = string.capitalize(data["package"])
if os.path.exists(target):
print "%s already exists, please remove it first" % target
print("%s already exists, please remove it first" % target)
sys.exit(1)
elif " " in data["package"]:
print "You should not use empty space in package name"
print("You should not use empty space in package name")
sys.exit(1)
# here we go
+1 -239
View File
@@ -1,239 +1 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# pisi-key script adopted from apt-key
#
# Author : Serdar Dalgic - serdar AT pardus DOT org DOT tr
# Any comments are welcomed
#
# TODO:
# * a python wrapper for GPG can be used instead of using python's subprocess module
# * Fill in rest of the functions
# WARNING!! Still a prototype
#
import sys
import os
import subprocess
# We don't use a secret keyring, of course, but gpg panics and
# implodes if there isn't one available
GPG_CMD = 'gpg --ignore-time-conflict --no-options --no-default-keyring \
--secret-keyring /etc/pisi/secring.gpg --trustdb-name /etc/pisi/trustdb.gpg'
GPG = GPG_CMD
MASTER_KEYRING = ''
ARCHIVE_KEYRING_URI = ''
# MASTER_KEYRING = '/usr/share/keyrings/pardus-master-keyring.gpg'
# ARCHIVE_KEYRING_URI = 'http://ftp.pardus.org.tr/pardus/pardus-archive-keyring.gpg'
ARCHIVE_KEYRING='/usr/share/keyrings/pardus-archive-keyring.gpg'
REMOVED_KEYS='/usr/share/keyrings/pardus-archive-removed-keys.gpg'
def addKey(GPG, keyfile):
""" add the key """
cmd = GPG + ' --quiet --batch --import %s' % keyfile
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def removeKey(GPG, keyfile):
""" remove the key """
cmd = GPG + ' --quiet --batch --delete-key --yes %s' % keyfile
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def update(GPG):
""" update keys using the keyring package:
we do not use add_keys_with_verify_against_master_keyring here,
because "update" is run on regular package updates. An
attacker might as well replace the master-archive-keyring file
in the package and add his own keys. so this check wouldn't
add any security. we *need* this check on net-update though """
if not os.access(ARCHIVE_KEYRING, os.F_OK):
print "ERROR: Can't find the archive-keyring"
print "Is the pisi-archive-keyring package installed?"
sys.exit(1)
cmd = GPG_CMD + ' --quiet --batch --keyring %s --export | %s --import' % (ARCHIVE_KEYRING, GPG)
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if not pipe.wait() == 0:
print "An error occured, inform the maintainer about this issue"
sys.exit(1)
if os.access(REMOVED_KEYS, os.R_OK):
# remove no-longer supported/used keys
cmd = '%s --keyring %s --with-colons --list-keys | grep ^pub | cut -d: -f5' % (GPG_CMD, REMOVED_KEYS)
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
keys = pipe.stdout.read()
for key in keys:
cmd = '%s --list-keys --with-colons | grep ^pub | cut -d: -f5 | grep -q %s' % (GPG, key)
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if pipe.stdout.read():
cmd = '%s --quiet --batch --delete-key --yes %s' % (GPG, key)
else:
print "Warning: removed keys keyring %s missing or not readable" % REMOVED_KEYS
sys.exit(1)
def net_update():
""" update the current archive signing keyring from a network URI:
the archive-keyring keys needs to be signed with the master key
(otherwise it does not make sense from a security POV) """
if len(ARCHIVE_KEYRING_URI) == 0:
print "Error: no location for the archive-keyring given"
sys.exit(1)
#TODO: Network connection should be checked!!
if not os.path.isdir("/var/lib/pisi/keyrings"):
os.mkdir("/var/lib/pisi/keyrings")
keyring = "/var/lib/pisi/keyrings/%s" ARCHIVE_KEYRING.split("/")[-1]
if os.path.exists(keyring):
old_mtime = os.stat(keyring).st_mtime
else:
old_mtime = 0
pass
def list_keys(GPG):
""" list keys """
cmd = GPG + ' --batch --list_keys'
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def list_fingerprints(GPG):
""" list fingerprints """
cmd = GPG + ' --batch --fingerprint'
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def export(GPG, keyid):
""" output the key with the <keyid> """
cmd = GPG + ' --armor --export %s' keyid
print "cmd: " + cmd
pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def exportAll(GPG):
""" output all trusted keys """
cmd = GPG + ' --armor --export'
print "cmd: " + cmd
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def printUsage():
"""
Prints usage information of application and exits.
"""
print "Usage: pisi-key [--keyring file] [command] [arguments]"
print
print "Manage pisi's list of trusted keys"
print
print " pisi-key add <file> - add the key contained in <file> ('-' for stdin)"
print " pisi-key del <keyid> - remove the key <keyid>"
print " pisi-key export <keyid> - output the key <keyid>"
print " pisi-key exportall - output all trusted keys"
print " pisi-key update - update keys using the keyring package"
print " pisi-key net-update - update keys using the network"
print " pisi-key list - list keys"
print " pisi-key finger - list fingerprints"
print " pisi-key adv - pass advanced options to gpg (download key)"
print
print "If no specific keyring file is given the command applies to all keyring files."
sys.exit(1)
if __name__ == '__main__':
if len(sys.argv) < 2:
printUsage()
sys.exit(1)
argc=1
#FIXME:: check whether gnupg is installed on the system or not!!
# Determine on which keyring we want to work
# if sys.argv[1] == '--keyring':
if sys.argv[argc] == '--keyring':
# keyring is the TRUSTEDFILE
argc += 1 # becomes 2
keyring = sys.argv[argc]
if not os.access(keyring, F_OK):
print "Error: The specified keyring %s is missing or not readable" % keyring
sys.exit(1)
argc += 1 # becomes 3
operation = sys.argv[argc]
GPG += ' --keyring %s --primary-keyring %s' % (keyring, keyring)
argc += 1 # becomes 4
else:
# otherwise use the default
keyring = '/etc/pisi/trusted.gpg'
if os.access(keyring, os.F_OK):
GPG += ' --keyring %s' % keyring
GPG += ' --primary-keyring %s' % keyring
#NOTICE:: TRUSTEDPARTS is not implemented.
operation = sys.argv[argc]
argc += 1 # becomes 2
# print 'COMMAND: %s' % GPG
if operation == 'help':
printUsage()
sys.exit(0)
elif operation == 'add':
keyfile = sys.argv[argc]
# TODO: check whether key_path is alive ('-' can be used for stdin) e.g. gpg --keyring pisi-keyring.gpg --armour --export 102030AB | pisi-key add -
addKey(GPG, keyfile)
print "Key in %s is succesfully added." % keyfile
elif operation == 'del':
keyfile = sys.argv[argc]
removeKey(GPG, keyfile)
print "Key in %s is succesfully deleted." % keyfile
elif operation == 'update':
update(GPG)
elif operation == 'net-update':
net_update()
elif operation == 'list':
list_keys(GPG)
elif operation == 'finger':
list_fingerprints(GPG)
elif operation == 'export':
keyid = sys.argv[argc]
export(GPG, keyid)
elif operation == 'exportall':
exportAll(GPG)
elif operation == 'adv':
adv_command = GPG + ' ' + sys.args[3:]
print 'Executing: ' + adv_command
# TODO: execute
pass
else:
printUsage()
Non
+17 -17
View File
@@ -24,13 +24,13 @@ EXT_SIGN = 'sig'
EXT_CERT = 'crt'
# Signature validity
SIGN_OK, SIGN_NO, SIGN_SELF, SIGN_UNTRUSTED, SIGN_CORRUPTED = range(5)
SIGN_OK, SIGN_NO, SIGN_SELF, SIGN_UNTRUSTED, SIGN_CORRUPTED = list(range(5))
# Certificate validity
CERT_OK, CERT_SELF, CERT_CORRUPTED = range(3)
CERT_OK, CERT_SELF, CERT_CORRUPTED = list(range(3))
# Certificate trustworthiness
CERT_TRUSTED, CERT_UNTRUSTED = range(2)
CERT_TRUSTED, CERT_UNTRUSTED = list(range(2))
def sign_data(data, key_file, password_fd):
"""
@@ -333,15 +333,15 @@ def sign_file(filename, key_file, cert_file, password_fd):
cert_file: Certificate
password_fd: File that contains passphrase
"""
data = file(filename).read()
data = open(filename).read()
signed_binary = sign_data(data, key_file, password_fd)
cert_data = file(cert_file).read()
cert_data = open(cert_file).read()
# Save certificate
file('%s.%s' % (filename, EXT_CERT), 'w').write(cert_data)
open('%s.%s' % (filename, EXT_CERT), 'w').write(cert_data)
# Save signed data
file('%s.%s' % (filename, EXT_SIGN), 'w').write(signed_binary)
open('%s.%s' % (filename, EXT_SIGN), 'w').write(signed_binary)
def sign_zipfile(filename, key_file, cert_file, password_fd):
"""
@@ -361,7 +361,7 @@ def sign_zipfile(filename, key_file, cert_file, password_fd):
signed_ascii = base64.b64encode(signed_binary)
# Encode certificate
cert_data = file(cert_file).read()
cert_data = open(cert_file).read()
cert_ascii = base64.b64encode(cert_data)
# Add signed data as ZIP comment
@@ -376,9 +376,9 @@ def print_usage():
Prints usage information of application and exits.
"""
print "Usage:"
print " %s sign <priv_key> <cert> <file1 ...>" % sys.argv[0]
print " %s verify <trust_dir> <file1 ...>" % sys.argv[0]
print("Usage:")
print((" %s sign <priv_key> <cert> <file1 ...>" % sys.argv[0]))
print((" %s verify <trust_dir> <file1 ...>" % sys.argv[0]))
sys.exit(1)
def main():
@@ -410,7 +410,7 @@ def main():
sign_zipfile(filename, key_file, cert_file, password_fd)
else:
sign_file(filename, key_file, cert_file, password_fd)
print "Signed %s with %s" % (filename, key_file)
print(("Signed %s with %s" % (filename, key_file)))
# Destroy temporary file
password_fd.close()
@@ -430,15 +430,15 @@ def main():
else:
result = verify_file(filename, trust_dir)
if result == SIGN_OK:
print "%s is signed by a trusted source." % filename
print(("%s is signed by a trusted source." % filename))
elif result == SIGN_NO:
print "%s is unsigned." % filename
print(("%s is unsigned." % filename))
elif result == SIGN_SELF:
print "%s is self-signed by a trusted source." % filename
print(("%s is self-signed by a trusted source." % filename))
elif result == SIGN_UNTRUSTED:
print "%s is signed by an untrusted source." % filename
print(("%s is signed by an untrusted source." % filename))
else:
print "%s is corrupted." % filename
print(("%s is corrupted." % filename))
else:
print_usage()
+7 -7
View File
@@ -21,7 +21,7 @@ import getopt
def chroot_comar(image_dir):
if os.fork() == 0:
try:
os.makedirs(os.path.join(image_dir, "var/db"), 0700)
os.makedirs(os.path.join(image_dir, "var/db"), 0o700)
except OSError:
pass
os.chroot(image_dir)
@@ -45,10 +45,10 @@ def chroot_comar(image_dir):
# run command and terminate if something goes wrong
def run(cmd, ignore_error=False):
print cmd
print(cmd)
ret = os.system(cmd)
if ret and not ignore_error:
print "%s returned %s" % (cmd, ret)
print("%s returned %s" % (cmd, ret))
sys.exit(1)
def create_sandbox(output_dir, repository):
@@ -66,11 +66,11 @@ def create_sandbox(output_dir, repository):
run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name)))
# Create character device
os.mknod("%s/dev/null" % output_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3))
os.mknod("%s/dev/console" % output_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1))
os.mknod("%s/dev/null" % output_dir, 0o666 | stat.S_IFCHR, os.makedev(1, 3))
os.mknod("%s/dev/console" % output_dir, 0o666 | stat.S_IFCHR, os.makedev(5, 1))
# Create urandom character device
os.mknod("%s/dev/urandom" % output_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9))
os.mknod("%s/dev/urandom" % output_dir, 0o666 | stat.S_IFCHR, os.makedev(1, 9))
# run command in chroot
def chrun(cmd):
@@ -85,7 +85,7 @@ def create_sandbox(output_dir, repository):
chrun("/usr/bin/hav call baselayout User.Manager setUser 0 'Root' '/root' '/bin/bash' 'pardus' '' ")
# Now it is 2011 release
file(os.path.join(output_dir, "etc/pardus-release"), "w").write("Pardus 2011\n")
open(os.path.join(output_dir, "etc/pardus-release"), "w").write("Pardus 2011\n")
except KeyboardInterrupt:
run('umount %s/proc' % output_dir, ignore_error=True)
+4 -4
View File
@@ -19,10 +19,10 @@ import pisi
import pisi.context as ctx
def usage():
print """
print("""
Usage:
pisisdr reponame
"""
""")
sys.exit(1)
def main():
@@ -33,8 +33,8 @@ def main():
try:
ctx.repodb.set_default_repo(repo)
except pisi.lockeddbshelve.Error, e:
print e
except pisi.lockeddbshelve.Error as e:
print(e)
if __name__ == "__main__":
sys.exit(main())
+3 -3
View File
@@ -17,7 +17,7 @@ import pisi
from optparse import OptionParser
def run(cmd):
print 'running', cmd
print(('running', cmd))
os.system(cmd)
if __name__ == "__main__":
@@ -48,7 +48,7 @@ if __name__ == "__main__":
(opts, args) = parser.parse_args()
print 'Exporting svn directory'
print('Exporting svn directory')
if not os.path.exists(opts.svndist):
os.makedirs(opts.svndist)
@@ -78,5 +78,5 @@ if __name__ == "__main__":
time = datetime.datetime.now()
os.rename('pisi-r%s.tar.bz2' % opts.rev , 'pisi-r%s-%s.%s.%s.tar.bz2' % (opts.rev, time.year, time.month, time.day))
print 'Have a look at %s directory' % opts.svndist
print(('Have a look at %s directory' % opts.svndist))
+3 -3
View File
@@ -9,7 +9,7 @@ import os
import shutil
def run(cmd):
print 'running', cmd
print(('running', cmd))
os.system(cmd)
sys.path.insert(0, '.')
@@ -22,10 +22,10 @@ ver = pisi.__version__
if os.path.exists('svndist/pisi-%s' % ver):
shutil.rmtree('svndist/pisi-%s' % ver)
print 'Exporting svn directory'
print('Exporting svn directory')
run('svn export http://svn.uludag.org.tr/uludag/trunk/pisi svndist/pisi-%s' % ver)
os.chdir('svndist')
run('tar cjvf pisi-%s.tar.bz2 pisi-%s' % (ver, ver))
print 'Have a look at svndist directory'
print('Have a look at svndist directory')
+7 -5
View File
@@ -16,13 +16,14 @@ from zipfile import BadZipfile
from pisi.package import Package
def usage(errmsg):
print """
print("""
Error: %s
Usage:
unpisi PiSi_package.pisi [target_dir]
""" % (errmsg)
""" % (errmsg))
sys.exit(1)
@@ -36,8 +37,8 @@ def main():
try:
package = Package(sys.argv[1])
except BadZipfile, e:
print e
except BadZipfile as e:
print(e)
sys.exit(1)
if not os.path.exists("install"):
@@ -53,10 +54,11 @@ def main():
package.extract_install(os.path.join(target, 'install'))
# FIXME: There is a Pisi bug, it already creates an install directory even its empty.
if os.listdir('install') == []:
if not os.listdir('install'):
os.rmdir('install')
return 0
if __name__ == "__main__":
sys.exit(main())