fix messages, source

This commit is contained in:
Dimitris Zlatanidis 2014-08-27 06:38:35 +03:00
parent cdf3091aae
commit 4dea1f95fb

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# build.py # build.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com> # Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved. # All rights reserved.
@ -10,7 +10,7 @@
# https://github.com/dslackw/slpkg # https://github.com/dslackw/slpkg
# This program is free software: you can redistribute it and/or modify # Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
@ -33,21 +33,20 @@ def build_package(script, sources, path):
''' '''
Build package from source Build package from source
''' '''
pkg_name = script.replace(".tar.gz", "") prgnam = script.replace(".tar.gz", "")
try: try:
tar = tarfile.open(script) tar = tarfile.open(script)
tar.extractall() tar.extractall()
tar.close() tar.close()
for src in sources: for src in sources:
shutil.copy2(src, pkg_name) shutil.copy2(src, prgnam)
os.chdir(path + pkg_name) os.chdir(path + prgnam)
subprocess.call("chmod +x {0}.SlackBuild".format(pkg_name), shell=True) subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
subprocess.call("./{0}.SlackBuild".format(pkg_name), shell=True) subprocess.call("./{0}.SlackBuild".format(prgnam), shell=True)
os.chdir(path) os.chdir(path)
except (OSError, IOError): except (OSError, IOError):
message = "Wrong file" message = "Wrong file"
bol, eol, pkg = "\n", "\n", "" pkg_not_found("\n", prgnam, message, "\n")
pkg_not_found(bol, pkg, message, eol)
except KeyboardInterrupt: except KeyboardInterrupt:
print # new line at exit print # new line at exit
sys.exit() sys.exit()