diff --git a/CHANGELOG b/CHANGELOG index 1a411b7b..c6319502 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +Version 2.0.0 +15-10-2014 + +[Updated] - Align PEP8 code style. + Fix sbo arch. + Update package splitting. + Version 1.9.9 11-10-2014 diff --git a/PKG-INFO b/PKG-INFO index 79ead23f..e1cb2fd1 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.9.9 +Version: 2.0.0 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw diff --git a/README.rst b/README.rst index d5eed0f1..b03f7127 100644 --- a/README.rst +++ b/README.rst @@ -7,9 +7,9 @@ Latest Release: -- Version: 1.9.9 +- Version: 2.0.0 - `Package `_ -- `Source `_ +- `Source `_ - `CHANGELOG `_ .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png @@ -86,7 +86,7 @@ Tutorial -------- .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png - :target: https://asciinema.org/a/12544 + :target: https://asciinema.org/a/12667 Installation @@ -96,8 +96,8 @@ Untar the archive and run install.sh script: .. code-block:: bash - $ tar xvf slpkg-1.9.9.tar.gz - $ cd slpkg-1.9.9 + $ tar xvf slpkg-2.0.0.tar.gz + $ cd slpkg-2.0.0 $ ./install.sh Using `pip `_ : @@ -446,7 +446,7 @@ Find installed packages: $ slpkg -f apr - Installed packages with name begin matching [ apr ] + Packages with matching name [ apr ] [ installed ] - apr-1.5.0-x86_64-1_slack14.1 [ installed ] - apr-util-1.5.3-x86_64-1_slack14.1 diff --git a/install.sh b/install.sh index 2f36b8b1..c2b3727b 100755 --- a/install.sh +++ b/install.sh @@ -21,7 +21,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-1.9.9} +VERSION=${VERSION:-2.0.0} TAG=${TAG:-_dsw} cd .. diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 8c906aaf..fe8b94c8 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-1.9.9} +VERSION=${VERSION:-2.0.0} BUILD=${BUILD:-1} TAG=${TAG:-_dsw} diff --git a/slackbuild/slpkg.info b/slackbuild/slpkg.info index 4294ae90..26e58963 100644 --- a/slackbuild/slpkg.info +++ b/slackbuild/slpkg.info @@ -1,7 +1,7 @@ PRGNAM="slpkg" -VERSION="1.9.9" +VERSION="2.0.0" HOMEPAGE="https://github.com/dslackw/slpkg" -DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.9.tar.gz" +DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.0.tar.gz" MD5SUM="" DOWNLOAD_x86_64="" MD5SUM_x86_64="" diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index a82f0020..cebf8ed7 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -58,14 +58,3 @@ bls_path = "/etc/slpkg/" ''' computer architecture ''' arch = os.uname()[4] - -''' Slackware architectures ''' -'''slack_archs = [ - "-noarch-", - "-x86_64-", - "-i386-", - "-i486-", - "-i686-", - "-x86-", - "-fw-" -]''' diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 8e909cba..964f7a5f 100755 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -83,18 +83,20 @@ class BlackList(object): conf.write(line) conf.close() + f = open(self.blackfile, "r") + self.black_conf = f.read() + f.close() + def packages(self): ''' Return blacklist packages from /etc/slpkg/blacklist configuration file. ''' blacklist = [] - with open(self.blackfile, "r") as black_conf: - for read in black_conf: - read = read.lstrip() - if not read.startswith("#"): - blacklist.append(read.replace("\n", "")) - black_conf.close() + for read in self.black_conf.splitlines(): + read = read.lstrip() + if not read.startswith("#"): + blacklist.append(read.replace("\n", "")) return blacklist def listed(self): @@ -134,16 +136,13 @@ class BlackList(object): ''' exit = 0 print("\nRemove packages from blacklist:\n") - with open(self.blackfile, "r") as black_conf: - lines = black_conf.read() - black_conf.close() - with open(self.blackfile, "w") as black_conf: - for line in lines.splitlines(): + with open(self.blackfile, "w") as remove: + for line in self.black_conf.splitlines(): if line not in pkgs: - black_conf.write(line + "\n") + remove.write(line + "\n") else: print("{0}{1}{2}".format(RED, line, ENDC)) exit = 1 - black_conf.close() + remove.close() if exit == 1: print # new line at exit diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 02dd027b..07f1d827 100755 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -34,7 +34,6 @@ def find_package(find_pkg, directory): pkgs = [] blacklist = BlackList().packages() for pkg in sorted(os.listdir(directory)): - name = split_package(pkg)[0] - if pkg.startswith(find_pkg) and name not in blacklist: + if pkg.startswith(find_pkg) and split_package(pkg)[0] not in blacklist: pkgs.append(pkg) return pkgs diff --git a/slpkg/queue.py b/slpkg/queue.py index 8fcf95ed..6b259705 100755 --- a/slpkg/queue.py +++ b/slpkg/queue.py @@ -58,18 +58,20 @@ class QueuePkgs(object): queue.write(line) queue.close() + f = open(self.queue_list, "r") + self.queued = f.read() + f.close() + def packages(self): ''' Return queue list from /var/lib/queue/queue_list file. ''' queue_list = [] - with open(self.queue_list, "r") as queue: - for read in queue: - read = read.lstrip() - if not read.startswith("#"): - queue_list.append(read.replace("\n", "")) - queue.close() + for read in self.queued.splitlines(): + read = read.lstrip() + if not read.startswith("#"): + queue_list.append(read.replace("\n", "")) return queue_list def listed(self): @@ -113,13 +115,10 @@ class QueuePkgs(object): ''' exit = 0 print("\nRemove packages from queue:\n") - with open(self.queue_list, "r") as queue: - lines = queue.read() - queue.close() if pkgs == ["all"]: pkgs = self.packages() with open(self.queue_list, "w") as queue: - for line in lines.splitlines(): + for line in self.queued.splitlines(): if line not in pkgs: queue.write(line + "\n") else: @@ -155,8 +154,7 @@ class QueuePkgs(object): def install(self): packages = self.packages() if packages: - # new line at start - print + print # new line at start for pkg in packages: # check if package exist in repository find = find_package(pkg, tmp) diff --git a/slpkg/splitting.py b/slpkg/splitting.py index ef0d46fd..7a318b67 100755 --- a/slpkg/splitting.py +++ b/slpkg/splitting.py @@ -38,5 +38,7 @@ def split_package(package): build = split[-1][:-len(slack)] else: build = split[-1] - arch, ver, name = split[-2], split[-3], "-".join(split[:-3]) + arch = split[-2] + ver = split[-3] + name = "-".join(split[:-3]) return [name, ver, arch, build]