mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
updated for version 1.6.1
This commit is contained in:
parent
b562fdbe17
commit
916f6ce1b0
18 changed files with 133 additions and 153 deletions
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 1.5.9
|
||||
Version: 1.6.1
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
60
README.rst
60
README.rst
|
@ -90,8 +90,6 @@ Command Line Tool Usage
|
|||
-f [ ...] find if packages installed
|
||||
-d [ ...] display the contents of the packages
|
||||
|
||||
|
||||
|
||||
Slpkg Examples
|
||||
--------------
|
||||
|
||||
|
@ -126,12 +124,12 @@ build and install with all dependencies :
|
|||
Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz.
|
||||
Package brasero-3.11.3-x86_64-1_SBo.tgz installed.
|
||||
|
||||
slpkg: package: orc was installed
|
||||
slpkg: package: gstreamer1 installed
|
||||
slpkg: package: gst1-plugins-base installed
|
||||
slpkg: package: gst1-plugins-bad installed
|
||||
slpkg: package: libunique installed
|
||||
slpkg: package: brasero installed
|
||||
slpkg: package orc was installed
|
||||
slpkg: package gstreamer1 installed
|
||||
slpkg: package gst1-plugins-base installed
|
||||
slpkg: package gst1-plugins-bad installed
|
||||
slpkg: package libunique installed
|
||||
slpkg: package brasero installed
|
||||
|
||||
|
||||
Tracking all dependencies of packages:
|
||||
|
@ -167,23 +165,20 @@ Check if your packages is up to date (www.slackbuilds.org):
|
|||
|
||||
Would you like to install ? [Y/y]
|
||||
|
||||
|
||||
$ slpkg -c ranger
|
||||
Searching `ranger` from slackbuilds.org ...
|
||||
|
||||
Your package is up to date
|
||||
slpkg: package ranger is up to date
|
||||
|
||||
|
||||
$ slpkg -c termcolor
|
||||
|
||||
The package `termcolor` not found on your system
|
||||
slpkg: No such package termcolor: Can't find
|
||||
|
||||
|
||||
Find slackbuild from network (www.slackbuilds.org):
|
||||
Find slackbuild from slackbuilds.org:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
$ slpkg -n bitfighter
|
||||
Searching `bitfighter` from slackbuilds.org ...
|
||||
|
||||
|
@ -204,13 +199,10 @@ Check if your packages is up to date (www.slackbuilds.org):
|
|||
|
||||
_
|
||||
|
||||
|
||||
Auto build tool to build package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
|
||||
Two files termcolor.tar.gz and termcolor-1.1.0.tar.gz
|
||||
must be in the same directory.
|
||||
|
||||
|
@ -302,7 +294,6 @@ Upgrade install package:
|
|||
#
|
||||
Package termcolor-1.1.0-x86_64-1_SBo.tgz installed.
|
||||
|
||||
|
||||
Of course you can install mass-packages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
@ -313,19 +304,21 @@ Of course you can install mass-packages:
|
|||
|
||||
$ slpkg -i *.t?z
|
||||
|
||||
|
||||
Find if your packages installed:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -f termcolor lua yetris you-get rar pip
|
||||
found --> termcolor-1.1.0-x86_64-1_SBo
|
||||
|
||||
slpkg: package: found --> termcolor-1.1.0
|
||||
slpkg: package: lua not found
|
||||
slpkg: package: found --> yetris-2.0.1
|
||||
slpkg: package: you-get not found
|
||||
slpkg: package: found --> rar-5.0.1
|
||||
slpkg: package: found --> pip-1.5.4
|
||||
slpkg: No such package lua: Can't find
|
||||
|
||||
found --> yetris-2.0.1-x86_64-1_SBo
|
||||
|
||||
slpkg: No such package you-get: Can't find
|
||||
|
||||
found --> rar-5.0.1-x86_64-1_SBo
|
||||
found --> pip-1.5.4-x86_64-1_SBo
|
||||
|
||||
Display the contents of the package:
|
||||
|
||||
|
@ -373,17 +366,17 @@ Display the contents of the package:
|
|||
install/
|
||||
install/slack-desc
|
||||
|
||||
slpkg: package: lua not found
|
||||
slpkg: No such package lua: Can't find
|
||||
|
||||
Remove package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -r termcolor
|
||||
These package(s) will be deleted:
|
||||
termcolor-1.1.0
|
||||
1 package marked
|
||||
Are you sure to remove this package(s) [y/n] y
|
||||
|
||||
delete --> termcolor-1.1.0-x86_64-1_SBo
|
||||
|
||||
Are you sure to remove 1 package(s) [Y/y] y
|
||||
|
||||
Package: termcolor-1.1.0-x86_64-1_SBo
|
||||
Removing...
|
||||
|
@ -412,9 +405,9 @@ Remove package:
|
|||
|
||||
$ slpkg -f termcolor lua rar
|
||||
|
||||
slpkg: package: termcolor not found
|
||||
slpkg: package: lua not found
|
||||
slpkg: package: found --> rar-5.0.1
|
||||
slpkg: No such package termcolor: Can't find
|
||||
slpkg: No such package lua: Can't find
|
||||
found --> rar-5.0.1-x86_64-1_SBo
|
||||
|
||||
$ slpkg -v
|
||||
Version: x.x.x
|
||||
|
@ -426,3 +419,4 @@ Man page it is available for full support:
|
|||
.. code-block:: bash
|
||||
|
||||
$ man slpkg
|
||||
|
||||
|
|
|
@ -206,10 +206,11 @@ $ \fBslpkg -u /tmp/termcolor-1.1.0-x86_64-1_SBo.tgz\fP
|
|||
Installing new package ./termcolor-1.1.0-x86_64-1_SBo.tgz
|
||||
|
||||
$ \fBslpkg -r termcolor yetris\fP
|
||||
These package(s) will be deleted:
|
||||
termcolor-1.1.0-x86_64-1_SBo
|
||||
Are you sure to remove this package [y/n] y
|
||||
|
||||
delete -- > termcolor-1.1.0-x86_64-1_SBo
|
||||
|
||||
Are you sure to remove 1 package(s) [Y/y]
|
||||
|
||||
Package: termcolor-1.1.0-x86_64-1_SBo
|
||||
Package: yetris-2.0.1-x86_64-1_SBo
|
||||
Removing...
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
|
||||
import os
|
||||
|
||||
__prog__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (1, 6, 0)
|
||||
__version_info__ = (1, 6, 1)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
||||
''' programm name '''
|
||||
__prog__ = "slpkg"
|
||||
|
||||
''' temponary path '''
|
||||
tmp = "/tmp/"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
class colors:
|
||||
'''
|
||||
Print out colors class
|
||||
Print foreground colors class
|
||||
'''
|
||||
RED = "\x1b[31m"
|
||||
GREEN = "\x1b[32m"
|
||||
|
|
|
@ -51,18 +51,6 @@ from sbo.dependency import *
|
|||
from sbo.check import sbo_check
|
||||
from sbo.views import sbo_network
|
||||
|
||||
def pkg_slackbuild(name):
|
||||
'''
|
||||
Select build package for build with extra source or not
|
||||
'''
|
||||
s_user(getpass.getuser())
|
||||
if len(name) == 2:
|
||||
build_package(name[0], name[1])
|
||||
elif len(name) > 2:
|
||||
build_extra_pkg(name[0], name[1], name[2:])
|
||||
else:
|
||||
print ("\n{0}: error: must enter at least two arguments\n".format(
|
||||
__prog__))
|
||||
|
||||
def main():
|
||||
description = "Utility to help package management in Slackware"
|
||||
|
@ -97,7 +85,14 @@ def main():
|
|||
if args.verbose:
|
||||
pkg_version()
|
||||
if args.a:
|
||||
pkg_slackbuild(args.a)
|
||||
s_user(getpass.getuser())
|
||||
if len(args.a) == 2:
|
||||
build_package(args.a[0], args.a[1])
|
||||
elif len(args.a) > 2:
|
||||
build_extra_pkg(args.a[0], args.a[1], args.a[2:])
|
||||
else:
|
||||
print ("\n{0}: error: must enter at least two arguments\n".format(
|
||||
__prog__))
|
||||
if args.l:
|
||||
pkg_list(args.l)
|
||||
if args.t:
|
||||
|
|
|
@ -5,41 +5,35 @@ import sys
|
|||
from colors import colors
|
||||
from __metadata__ import __prog__
|
||||
|
||||
def file_not_found(file):
|
||||
'''
|
||||
Print message when binary file not found
|
||||
'''
|
||||
print ("\n{0}: can't find {1}: No such file or directrory\n".format(__prog__, file))
|
||||
|
||||
def pkg_not_found(pkg):
|
||||
def pkg_not_found(pkg, message):
|
||||
'''
|
||||
Print message when package not found
|
||||
'''
|
||||
print ("\n\n{0}: can't find {1}: from slackbuilds.org\n".format(__prog__, pkg))
|
||||
print ("\n{0}: No such package {1}: {2}\n".format(__prog__, pkg, message))
|
||||
|
||||
def pkg_found(pkg):
|
||||
'''
|
||||
Print message when package found
|
||||
'''
|
||||
print ("| {0}: package: {1} is already installed".format(__prog__, pkg))
|
||||
print ("| {0}: package {1} is already installed".format(__prog__, pkg))
|
||||
|
||||
def pkg_installed(pkg):
|
||||
'''
|
||||
Print message when package installed
|
||||
'''
|
||||
print ("| {0}: package: {1} installed".format(__prog__, pkg))
|
||||
print ("| {0}: package {1} installed".format(__prog__, pkg))
|
||||
|
||||
def s_user(user):
|
||||
'''
|
||||
Check for root user
|
||||
'''
|
||||
if user != "root":
|
||||
print ("\n{0}: error: must have root privileges\n".format(__prog__))
|
||||
print ("{0}: error: must have root privileges".format(__prog__))
|
||||
sys.exit()
|
||||
|
||||
def template(max):
|
||||
'''
|
||||
Print massage tamplate
|
||||
Print view template
|
||||
'''
|
||||
print ("+" + "=" * max)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import shutil
|
|||
import tarfile
|
||||
import subprocess
|
||||
|
||||
from ..messages import file_not_found
|
||||
from slpkg.messages import pkg_not_found
|
||||
|
||||
def build_extra_pkg(script, source, extra):
|
||||
'''
|
||||
|
@ -24,7 +24,7 @@ def build_extra_pkg(script, source, extra):
|
|||
os.chdir(path + pkg_name)
|
||||
os.system("sh {0}{1}{2}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
||||
except (OSError, IOError):
|
||||
file_not_found(file='')
|
||||
pkg_not_found(pkg='', message="Wrong file")
|
||||
|
||||
def build_package(script, source):
|
||||
'''
|
||||
|
@ -41,4 +41,4 @@ def build_package(script, source):
|
|||
os.system("sh {0}{1}{2}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
||||
os.chdir(path)
|
||||
except (OSError, IOError):
|
||||
file_not_found(file='')
|
||||
pkg_not_found(pkg='', message="Wrong file")
|
||||
|
|
|
@ -6,9 +6,9 @@ import sys
|
|||
import getpass
|
||||
import subprocess
|
||||
|
||||
from ..colors import colors
|
||||
from ..messages import file_not_found, s_user, template
|
||||
from ..__metadata__ import packages, __prog__, uname, arch
|
||||
from slpkg.colors import colors
|
||||
from slpkg.messages import pkg_not_found, s_user, template
|
||||
from slpkg.__metadata__ import packages, __prog__, uname, arch
|
||||
|
||||
from find import find_package
|
||||
|
||||
|
@ -21,7 +21,7 @@ def pkg_install(binary):
|
|||
try:
|
||||
print subprocess.check_output('installpkg {0}'.format(binary[pkg]), shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
file_not_found(binary[pkg])
|
||||
pkg_not_found(binary[pkg], message="Can't install")
|
||||
|
||||
def pkg_upgrade(binary):
|
||||
'''
|
||||
|
@ -33,7 +33,7 @@ def pkg_upgrade(binary):
|
|||
print subprocess.check_output('upgradepkg --install-new {0}'.format(binary[pkg]),
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
file_not_found(binary[pkg])
|
||||
pkg_not_found(binary[pkg], message="Can't upgrade")
|
||||
|
||||
def pkg_reinstall(binary):
|
||||
'''
|
||||
|
@ -45,7 +45,7 @@ def pkg_reinstall(binary):
|
|||
print subprocess.check_output('upgradepkg --reinstall {0}'.format(binary[pkg]),
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
file_not_found(binary[pkg])
|
||||
pkg_not_found(binary[pkg], message="Can't reinstall")
|
||||
|
||||
def pkg_remove(binary):
|
||||
'''
|
||||
|
@ -55,25 +55,22 @@ def pkg_remove(binary):
|
|||
pkgs = []
|
||||
for pkg in range(len(binary)):
|
||||
if find_package(binary[pkg], packages) == []:
|
||||
file_not_found(binary[pkg])
|
||||
pkg_not_found(binary[pkg], message="Can't remove")
|
||||
else:
|
||||
pkgs.append(binary[pkg])
|
||||
if pkgs == []:
|
||||
sys.exit()
|
||||
print ("These package(s) will be deleted:")
|
||||
count = []
|
||||
for pkg in range(len(binary)):
|
||||
pkgs = find_package(binary[pkg], packages)
|
||||
print # new line at start
|
||||
if pkgs != []:
|
||||
sbo_tag_len = len(arch) + 7
|
||||
found_pkg = pkgs[0][:-sbo_tag_len]
|
||||
print (colors.RED + found_pkg + colors.ENDC)
|
||||
print (colors.RED + "delete --> " + colors.ENDC + "\n ".join(pkgs))
|
||||
count.append(pkgs)
|
||||
sum_pkgs = 0
|
||||
for i in range(len(count)):
|
||||
sum_pkgs += len(count[i])
|
||||
print ("{0}{1} package marked{2}".format(colors.GREEN, sum_pkgs, colors.ENDC))
|
||||
remove_pkg = raw_input("Are you sure to remove this package(s) [Y/y] ")
|
||||
remove_pkg = raw_input("\nAre you sure to remove " + str(sum_pkgs) + " package(s) [Y/y] ")
|
||||
if remove_pkg == "y" or remove_pkg == "Y":
|
||||
results_removed = []
|
||||
not_found = []
|
||||
|
@ -82,11 +79,11 @@ def pkg_remove(binary):
|
|||
not_found.append(binary[pkg])
|
||||
else:
|
||||
try:
|
||||
results_removed.append("".join(find_package(binary[pkg], packages)))
|
||||
print subprocess.check_output('removepkg {0}'.format(binary[pkg]),
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
file_not_found(binary[pkg])
|
||||
results_removed.append(binary[pkg])
|
||||
template(78)
|
||||
for file in results_removed:
|
||||
if find_package(file, packages) == []:
|
||||
|
@ -94,22 +91,18 @@ def pkg_remove(binary):
|
|||
for file in not_found:
|
||||
print ("| {0}: package: {1} not found".format(__prog__, file))
|
||||
template(78)
|
||||
print
|
||||
print # new line at end
|
||||
|
||||
def pkg_find(binary):
|
||||
'''
|
||||
Find installed Slackware packages
|
||||
'''
|
||||
print
|
||||
for pkg in range(len(binary)):
|
||||
if find_package(binary[pkg], packages) == []:
|
||||
print ("{0}: package: {1} not found".format(__prog__, binary[pkg]))
|
||||
pkg_not_found(binary[pkg], message="Can't find")
|
||||
else:
|
||||
found_pkg = find_package(binary[pkg], packages)
|
||||
sbo_tag_len = len(arch) + 7
|
||||
found_pkg = found_pkg[0][:-sbo_tag_len]
|
||||
print (__prog__ + ": package: " + colors.GREEN + "found --> " + colors.ENDC + found_pkg)
|
||||
print
|
||||
print (colors.GREEN + "found --> " + colors.ENDC + "\n ".join(
|
||||
find_package(binary[pkg], packages)))
|
||||
|
||||
def pkg_display(binary):
|
||||
'''
|
||||
|
@ -117,10 +110,10 @@ def pkg_display(binary):
|
|||
'''
|
||||
for pkg in range(len(binary)):
|
||||
if find_package(binary[pkg], packages) == []:
|
||||
file_not_found(binary[pkg])
|
||||
pkg_not_found(binary[pkg], message="Can't find")
|
||||
else:
|
||||
print subprocess.check_output("cat {0}{1}".format(packages,
|
||||
"\n".join(find_package(binary[pkg], packages))), shell=True)
|
||||
" /var/log/packages/".join(find_package(binary[pkg], packages))), shell=True)
|
||||
|
||||
def pkg_list(binary):
|
||||
'''
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
import os
|
||||
import getpass
|
||||
|
||||
from ..pkg.build import *
|
||||
from ..pkg.find import find_package
|
||||
from ..pkg.manager import pkg_upgrade
|
||||
from slpkg.pkg.build import *
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from ..colors import colors
|
||||
from ..functions import get_file
|
||||
from ..__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from ..__metadata__ import __prog__, tmp, packages, uname, arch
|
||||
from ..messages import file_not_found, pkg_not_found, s_user, template
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import pkg_not_found, s_user, template
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from slpkg.__metadata__ import __prog__, tmp, packages, uname, arch
|
||||
|
||||
from search import sbo_search_pkg
|
||||
from download import sbo_slackbuild_dwn
|
||||
|
@ -24,11 +24,11 @@ def sbo_check(name):
|
|||
'''
|
||||
sbo_file = " ".join(find_package(name, packages))
|
||||
if sbo_file == "":
|
||||
file_not_found(name)
|
||||
pkg_not_found(name, message="Can't find")
|
||||
else:
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
pkg_not_found(name)
|
||||
pkg_not_found(name, message="Can't find")
|
||||
else:
|
||||
sbo_version = sbo_version_pkg(sbo_url, name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
|
@ -59,7 +59,8 @@ def sbo_check(name):
|
|||
for link in extra_dwn:
|
||||
extra.append(get_file(link, "/"))
|
||||
build_extra_pkg(script, source, extra)
|
||||
binary = (tmp + pkg_for_install + sbo_arch + sbo_tag + sbo_filetype).split()
|
||||
binary = (tmp + pkg_for_install + sbo_arch + sbo_tag + \
|
||||
sbo_filetype).split()
|
||||
pkg_upgrade(binary)
|
||||
sys.exit()
|
||||
build_package(script, source)
|
||||
|
@ -67,4 +68,5 @@ def sbo_check(name):
|
|||
pkg_upgrade(binary)
|
||||
print
|
||||
else:
|
||||
print ("\n\n{0}: package: {1} is up to date\n".format(__prog__, name))
|
||||
print ("\n\n{0}: package {1} is up to date\n".format(__prog__,
|
||||
"".join(find_package(name, packages))))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from ..colors import colors
|
||||
from ..__metadata__ import __prog__
|
||||
from ..messages import pkg_not_found, template
|
||||
from slpkg.colors import colors
|
||||
from slpkg.__metadata__ import __prog__
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
|
||||
from greps import *
|
||||
from search import sbo_search_pkg
|
||||
|
@ -19,14 +19,14 @@ def sbo_dependencies_pkg(name):
|
|||
if name != "%README%":
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
pkg_not_found(name)
|
||||
pkg_not_found(name, message="Can't find")
|
||||
else:
|
||||
sbo_req = sbo_requires_pkg(sbo_url, name)
|
||||
dependencies = sbo_req.split()
|
||||
if dependencies != []:
|
||||
dep_results.append(dependencies)
|
||||
for line in dependencies:
|
||||
print
|
||||
print # new line after dependency
|
||||
sbo_dependencies_pkg(line)
|
||||
return dep_results
|
||||
|
||||
|
@ -37,7 +37,7 @@ def sbo_dependencies_links_pkg(name):
|
|||
if name != "%README%":
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
pkg_not_found(name)
|
||||
pkg_not_found(name, message="Can't find")
|
||||
else:
|
||||
version = ("@" + sbo_version_pkg(sbo_url, name)).split()
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name).split()
|
||||
|
@ -54,7 +54,7 @@ def sbo_dependencies_links_pkg(name):
|
|||
if sbo_req != []:
|
||||
dep_links_results.append(sbo_req)
|
||||
for line in sbo_req:
|
||||
print
|
||||
print # new line after dependecy
|
||||
sbo_dependencies_links_pkg(line)
|
||||
return dep_links_results
|
||||
|
||||
|
@ -66,7 +66,7 @@ def pkg_tracking(name):
|
|||
if dependencies is None:
|
||||
pass
|
||||
elif dependencies == []:
|
||||
print ("\n\n{0}: package: {1} no dependencies\n".format( __prog__, name))
|
||||
print ("\n\n{0}: package {1} no dependencies\n".format( __prog__, name))
|
||||
else:
|
||||
pkg_len = len(name) + 18
|
||||
print ("\n")
|
||||
|
@ -80,4 +80,4 @@ def pkg_tracking(name):
|
|||
found = " +--", str(len(dependencies[i])), ", ".join(dependencies[i])
|
||||
print (" |")
|
||||
print " ".join(found)
|
||||
print
|
||||
print # new line at end
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
def sbo_slackbuild_dwn(sbo_url, name):
|
||||
'''
|
||||
Find SlackBuilds packages links for download
|
||||
Convert http repository link to
|
||||
slackbuild download link
|
||||
'''
|
||||
sbo_url = sbo_url.replace(name + "/", name + ".tar.gz")
|
||||
return sbo_url.replace("repository", "slackbuilds")
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from ..url_read import url_read
|
||||
from ..__metadata__ import uname, arch
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.__metadata__ import uname, arch
|
||||
|
||||
def sbo_source_dwn(sbo_url, name):
|
||||
'''
|
||||
Find source code link for download
|
||||
Grep source code download link
|
||||
'''
|
||||
read_info = url_read((sbo_url + name + ".info").replace(
|
||||
"repository", "slackbuilds"))
|
||||
|
@ -22,7 +22,7 @@ def sbo_source_dwn(sbo_url, name):
|
|||
|
||||
def sbo_extra_dwn(sbo_url, name):
|
||||
'''
|
||||
Find exrtra source code link for download
|
||||
Grep extra source code download link
|
||||
'''
|
||||
read_info = url_read((sbo_url + name + ".info").replace(
|
||||
"repository", "slackbuilds"))
|
||||
|
@ -38,20 +38,20 @@ def sbo_extra_dwn(sbo_url, name):
|
|||
|
||||
def sbo_requires_pkg(sbo_url, name):
|
||||
'''
|
||||
Search for package requirements
|
||||
Grep package requirements
|
||||
'''
|
||||
read_info = url_read((sbo_url + name + ".info").replace(
|
||||
"repository", "slackbuilds"))
|
||||
"repository", "slackbuilds"))
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith('REQUIRES="'):
|
||||
return line[10:-1]
|
||||
|
||||
def sbo_version_pkg(sbo_url, name):
|
||||
'''
|
||||
Find the version package from slackbuilds.org
|
||||
Grep package version
|
||||
'''
|
||||
read_info = url_read((sbo_url + name + ".info").replace(
|
||||
"repository", "slackbuilds"))
|
||||
"repository", "slackbuilds"))
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith('VERSION="'):
|
||||
return line[9:-1]
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
import os
|
||||
import getpass
|
||||
|
||||
from ..messages import s_user
|
||||
from ..url_read import url_read
|
||||
from slpkg.messages import s_user
|
||||
from slpkg.url_read import url_read
|
||||
|
||||
# create tmp directory
|
||||
os.system("mkdir -p /tmp/slpkg/readme/")
|
||||
|
@ -22,7 +22,7 @@ def read_readme(sbo_url, name, site):
|
|||
|
||||
def read_info_slackbuild(sbo_url, name, site):
|
||||
'''
|
||||
Read .info SlackBuild file
|
||||
Read info SlackBuild file
|
||||
'''
|
||||
s_user(getpass.getuser())
|
||||
info = url_read((sbo_url + name + site).replace("repository", "slackbuilds"))
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
import re
|
||||
import sys
|
||||
|
||||
from ..url_read import url_read
|
||||
from ..functions import rmv_unused
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.functions import rmv_unused
|
||||
|
||||
from repository import repository
|
||||
|
||||
|
@ -29,3 +29,5 @@ def sbo_search_pkg(name):
|
|||
find_SBo = rmv_unused(" ".join(find_SBo))
|
||||
if name in find_SBo:
|
||||
return sbo_url_sub + name + "/"
|
||||
sys.stdout.write("\n")
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@ import os
|
|||
import sys
|
||||
import getpass
|
||||
|
||||
from ..colors import colors
|
||||
from ..functions import get_file
|
||||
from ..__metadata__ import tmp, packages, __prog__
|
||||
from ..__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from ..messages import s_user, pkg_found, pkg_installed, template
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import tmp, packages, __prog__
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from slpkg.messages import s_user, pkg_found, pkg_installed, template
|
||||
|
||||
from ..pkg.build import *
|
||||
from ..pkg.find import find_package
|
||||
from ..pkg.manager import pkg_upgrade
|
||||
from slpkg.pkg.build import *
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from dependency import sbo_dependencies_links_pkg
|
||||
|
||||
|
@ -35,7 +35,7 @@ def sbo_build(name):
|
|||
for j in range(len(dependencies_links[i])):
|
||||
results.append(dependencies_links[i][j])
|
||||
'''
|
||||
grep only links from list
|
||||
grep http links from list
|
||||
'''
|
||||
dwn_link = []
|
||||
for link in results:
|
||||
|
@ -44,7 +44,7 @@ def sbo_build(name):
|
|||
if link.startswith('ftp'):
|
||||
dwn_link.append(link)
|
||||
'''
|
||||
grep the version
|
||||
grep package version
|
||||
'''
|
||||
version = []
|
||||
for ver in results:
|
||||
|
@ -74,7 +74,7 @@ def sbo_build(name):
|
|||
filename.append(file)
|
||||
y += 2
|
||||
'''
|
||||
link sbo filename with version to create package installation
|
||||
create package installation package + version
|
||||
'''
|
||||
filename_version = []
|
||||
for i in range(len(filename)):
|
||||
|
@ -156,4 +156,4 @@ def sbo_build(name):
|
|||
if find_package(pkg, packages) != []:
|
||||
pkg_found(pkg)
|
||||
template(78)
|
||||
print
|
||||
print # new line at end
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from ..colors import colors
|
||||
from ..functions import get_file
|
||||
from ..__metadata__ import tmp, packages
|
||||
from ..__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from ..messages import s_user, pkg_not_found, pkg_found, view_sbo, template
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import tmp, packages
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype
|
||||
from slpkg.messages import s_user, pkg_not_found, pkg_found, view_sbo, template
|
||||
|
||||
from ..pkg.build import *
|
||||
from ..pkg.find import find_package
|
||||
from ..pkg.manager import pkg_upgrade
|
||||
from slpkg.pkg.build import *
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from read import *
|
||||
from greps import *
|
||||
|
@ -24,7 +24,7 @@ def sbo_network(name):
|
|||
'''
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
pkg_not_found(name)
|
||||
pkg_not_found(name, message="Can't find")
|
||||
else:
|
||||
sbo_req = sbo_requires_pkg(sbo_url, name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
|
@ -98,7 +98,7 @@ def sbo_network(name):
|
|||
break
|
||||
else:
|
||||
template(78)
|
||||
pkg_found(name)
|
||||
pkg_found(''.join(find_package(name, packages)))
|
||||
template(78)
|
||||
break
|
||||
else:
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
import urllib2
|
||||
from __metadata__ import __prog__
|
||||
|
||||
def url_read(name):
|
||||
def url_read(link):
|
||||
'''
|
||||
Open url and read
|
||||
'''
|
||||
try:
|
||||
f = urllib2.urlopen(name)
|
||||
f = urllib2.urlopen(link)
|
||||
return f.read()
|
||||
except urllib2.URLError:
|
||||
print ("\n{0}: error: connection refused".format(__prog__))
|
||||
|
|
Loading…
Add table
Reference in a new issue