update source v2.0.2

This commit is contained in:
Dimitris Zlatanidis 2014-10-21 06:32:30 +03:00
parent be9a61aee4
commit 7324c1d690
16 changed files with 104 additions and 98 deletions

View file

@ -1,3 +1,8 @@
Version 2.0.2
21-10-2014
[Updated] - Update source.
Version 2.0.1
20-10-2014

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
Version: 2.0.1
Version: 2.0.2
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -3,7 +3,7 @@
.. image:: https://travis-ci.org/dslackw/slpkg.svg?branch=master
:target: https://travis-ci.org/dslackw/slpkg
.. image:: https://landscape.io/github/dslackw/slpkg/master/landscape.png
:target: https://landscape.io/github/dslackw/slpkg/master
:target: https://landscape.io/github/dslackw/slpkg/master
.. image:: https://pypip.in/d/slpkg/badge.png
:target: https://pypi.python.org/pypi/slpkg
.. image:: https://pypip.in/license/slpkg/badge.png
@ -11,9 +11,9 @@
Latest Release:
- Version: 2.0.1
- Version: 2.0.2
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.1.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.2.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -100,8 +100,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-2.0.1.tar.gz
$ cd slpkg-2.0.1
$ tar xvf slpkg-2.0.2.tar.gz
$ cd slpkg-2.0.2
$ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ :

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-2.0.1}
VERSION=${VERSION:-2.0.2}
TAG=${TAG:-_dsw}
cd ..

View file

@ -26,7 +26,7 @@ import sys
import gzip
import shutil
from slpkg import __version__, __email__, __author__
from slpkg.__metadate__ import __version__, __email__, __author__
try:
from setuptools import setup

View file

@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-2.0.1}
VERSION=${VERSION:-2.0.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="2.0.1"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.1.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.2.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

@ -1,5 +1 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from main import *
from __metadata__ import __author__, __version__, __license__, __email__
# [ main ] directory

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (2, 0, 1)
__version_info__ = (2, 0, 2)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -103,20 +103,20 @@ class BlackList(object):
'''
Print blacklist packages
'''
exit = 0
quit = 0
print("\nPackages in blacklist:\n")
for black in self.packages():
if black:
print("{0}{1}{2}".format(GREEN, black, ENDC))
exit = 1
if exit == 1:
quit = 1
if quit == 1:
print # new line at exit
def add(self, pkgs):
'''
Add blacklist packages if not exist
'''
exit = 0
quit = 0
blacklist = self.packages()
pkgs = set(pkgs)
print("\nAdd packages in blacklist:\n")
@ -125,16 +125,16 @@ class BlackList(object):
if pkg not in blacklist:
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
black_conf.write(pkg + "\n")
exit = 1
quit = 1
black_conf.close()
if exit == 1:
if quit == 1:
print # new line at exit
def remove(self, pkgs):
'''
Remove packages from blacklist
'''
exit = 0
quit = 0
print("\nRemove packages from blacklist:\n")
with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines():
@ -142,7 +142,7 @@ class BlackList(object):
remove.write(line + "\n")
else:
print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1
quit = 1
remove.close()
if exit == 1:
if quit == 1:
print # new line at exit

View file

@ -66,11 +66,11 @@ def build_FAILED(sbo_url, prgnam):
print # new line at end
def template(max):
def template(max_len):
'''
Print template
'''
print("+" + "=" * max)
print("+" + "=" * max_len)
def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req):

View file

@ -101,8 +101,7 @@ class PackageManager(object):
[removed,
dependencies,
rmv_list,
rmv_dependencies
] = ([] for i in range(4))
] = ([] for i in range(3))
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
CYAN, ", ".join(self.binary), ENDC))
for pkg in self.binary:
@ -162,7 +161,6 @@ class PackageManager(object):
shell=True))
rmv_list.append(dep)
os.remove(dep_path + rmv)
rmv_dependencies += dependencies[:-1]
else:
if find_package(rmv + sp, pkg_path):
print(subprocess.check_output(

View file

@ -79,20 +79,20 @@ class QueuePkgs(object):
'''
Print packages from queue
'''
exit = 0
quit = 0
print("\nPackages in queue:\n")
for pkg in self.packages():
if pkg:
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
exit = 1
if exit == 1:
quit = 1
if quit == 1:
print # new line at exit
def add(self, pkgs):
'''
Add packages in queue if not exist
'''
exit = 0
quit = 0
queue_list = self.packages()
pkgs = set(pkgs)
print("\nAdd packages in queue:\n")
@ -102,19 +102,19 @@ class QueuePkgs(object):
if pkg not in queue_list and find is not None:
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
queue.write(pkg + "\n")
exit = 1
quit = 1
else:
print("{0}{1}{2}".format(RED, pkg, ENDC))
exit = 1
quit = 1
queue.close()
if exit == 1:
if quit == 1:
print # new line at exit
def remove(self, pkgs):
'''
Remove packages from queue
'''
exit = 0
quit = 0
print("\nRemove packages from queue:\n")
if pkgs == ["all"]:
pkgs = self.packages()
@ -124,9 +124,9 @@ class QueuePkgs(object):
queue.write(line + "\n")
else:
print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1
quit = 1
queue.close()
if exit == 1:
if quit == 1:
print # new line at exit
def build(self):

View file

@ -28,10 +28,10 @@ from init import initialization
from __metadata__ import pkg_path, sp
from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
from dependency import sbo_dependencies_pkg
from pkg.find import find_package
from dependency import sbo_dependencies_pkg
def track_dep(name):
'''

View file

@ -53,13 +53,15 @@ def sbo_network(name):
sys.stdout.flush()
initialization()
sbo_url = sbo_search_pkg(name)
sys.stdout.write(done)
if sbo_url:
grep = SBoGrep(name)
sbo_desc = grep.description()[len(name) + 2:-1]
sbo_req = grep.requires()
source_dwn = grep.source().split()
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
sys.stdout.write(done)
sbo_version = grep.version()
prgnam = ("{0}-{1}".format(name, sbo_version))
view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1],
", ".join([src.split("/")[-1] for src in source_dwn]),
sbo_req)
@ -71,72 +73,30 @@ def sbo_network(name):
FAULT = "".join(source_dwn)
while True:
try:
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
choice = raw_input(" {0}Choose an option: {1}".format(GREY,
ENDC))
except KeyboardInterrupt:
print # new line at exit
break
if read == "D" or read == "d":
path = ""
Download(path, sbo_dwn).start()
for src in source_dwn:
Download(path, src).start()
if choice in ["D", "d"]:
download("", sbo_dwn, source_dwn)
break
elif read == "R" or read == "r":
elif choice in ["R", "r"]:
readme = "README"
pydoc.pager(read_readme(sbo_url, readme))
elif read == "F" or read == "f":
elif choice in ["F", "f"]:
_info = ".info"
pydoc.pager(read_info_slackbuild(sbo_url, name, _info))
elif read == "S" or read == "s":
elif choice in ["S", "s"]:
_SlackBuild = ".SlackBuild"
pydoc.pager(read_info_slackbuild(sbo_url, name, _SlackBuild))
elif read == "B" or read == "b":
if FAULT:
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sources = []
os.chdir(build_path)
script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
elif choice in ["B", "b"]:
build(sbo_dwn, source_dwn, FAULT)
break
elif read == "I" or read == "i":
if FAULT:
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sbo_version = grep.version()
prgnam = ("{0}-{1}".format(name, sbo_version))
elif choice in ["I", "i"]:
if not find_package(prgnam + sp, pkg_path):
sources = []
os.chdir(build_path)
Download(build_path, sbo_dwn).start()
script = sbo_dwn.split("/")[-1]
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
# Searches the package name and version in /tmp to install.
# If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
binary_list.append(search)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC,
name))
PackageManager(binary).upgrade()
build(sbo_dwn, source_dwn, FAULT)
install(name, prgnam, sbo_url)
break
else:
template(78)
@ -146,6 +106,52 @@ def sbo_network(name):
else:
break
else:
sys.stdout.write(done)
message = "Can't view"
pkg_not_found("\n", name, message, "\n")
def download(path, sbo_dwn, source_dwn):
'''
Download sources
'''
Download(path, sbo_dwn).start()
for src in source_dwn:
Download(path, src).start()
def build(sbo_dwn, source_dwn, FAULT):
'''
Only build and create Slackware package
'''
if FAULT:
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sources = []
os.chdir(build_path)
Download(build_path, sbo_dwn).start()
script = sbo_dwn.split("/")[-1]
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
def install(name, prgnam, sbo_url):
'''
Install Slackware package found in /tmp
directory.
'''
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
binary_list.append(search)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC,
name))
PackageManager(binary).upgrade()

View file

@ -22,6 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __metadata__ import arch
from slack_version import slack_ver