Update doc string

This commit is contained in:
Dimitris Zlatanidis 2015-09-27 12:11:01 +03:00
parent b937ab5d02
commit 5a795dff78
24 changed files with 54 additions and 95 deletions

View file

@ -37,8 +37,7 @@ from slpkg.binary.repo_init import RepoInit
def pkg_upgrade(repo, skip, flag):
"""
Checking packages for upgrade
"""Checking packages for upgrade
"""
Msg().checking()
PACKAGES_TXT = RepoInit(repo).fetch()[0]
@ -67,7 +66,6 @@ def pkg_upgrade(repo, skip, flag):
def installed():
"""
Return all installed packages
"""Return all installed packages
"""
return find_package("", _meta_.pkg_path)

View file

@ -41,8 +41,7 @@ class Dependencies(object):
self.meta = _meta_
def binary(self, name, flag):
"""
Build all dependencies of a package
"""Build all dependencies of a package
"""
if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
sys.setrecursionlimit(10000)

View file

@ -31,8 +31,7 @@ from slpkg.slack.slack_version import slack_ver
def repo_data(PACKAGES_TXT, repo, flag):
"""
Grap data packages
"""Grap data packages
"""
(name, location, size, unsize,
rname, rlocation, rsize, runsize) = ([] for i in range(8))
@ -77,8 +76,7 @@ def repo_data(PACKAGES_TXT, repo, flag):
def rlw_filter(name, location, size, unsize):
"""
Filter rlw repository data
"""Filter rlw repository data
"""
arch = _meta_.arch
if arch.startswith("i") and arch.endswith("86"):
@ -108,8 +106,7 @@ def alien_filter(name, location, size, unsize):
def rested_filter(name, location, size, unsize):
"""
Filter Alien"s repository data
"""Filter Alien"s repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
@ -128,8 +125,7 @@ def rested_filter(name, location, size, unsize):
def ktown_filter(name, location, size, unsize):
"""
Filter Alien"s ktown repository data
"""Filter Alien"s ktown repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
@ -155,8 +151,7 @@ class Requires(object):
self.repo = repo
def get_deps(self):
"""
Grap package requirements from repositories
"""Grap package requirements from repositories
"""
if self.repo == "rlw":
# Robby"s repository dependencies as shown in the central page
@ -185,8 +180,7 @@ class Requires(object):
return self._req_fix(line)
def _req_fix(self, line):
"""
Fix slacky and salix requirements because many dependencies splitting
"""Fix slacky and salix requirements because many dependencies splitting
with "," and others with "|"
"""
deps = []

View file

@ -158,8 +158,7 @@ class BinaryInstall(object):
self.deps_dict[dep] = deps
def clear_masters(self):
"""
Clear master packages if already exist in dependencies
"""Clear master packages if already exist in dependencies
or if added to install two or more times
"""
packages = []
@ -169,8 +168,7 @@ class BinaryInstall(object):
self.packages = packages
def install_packages(self):
"""
Install or upgrade packages
"""Install or upgrade packages
"""
installs, upgraded = [], []
for inst in (self.dep_install + self.install):
@ -196,14 +194,12 @@ class BinaryInstall(object):
return [installs, upgraded]
def checksums(self, install):
"""
Checksums before install
"""Checksums before install
"""
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
def resolving_deps(self):
"""
Return package dependencies
"""Return package dependencies
"""
requires = []
if (self.meta.rsl_deps in ["on", "ON"] and
@ -220,8 +216,7 @@ class BinaryInstall(object):
return Utils().remove_dbs(requires)
def views(self, install, comp_sum):
"""
Views packages
"""Views packages
"""
pkg_sum = uni_sum = upg_sum = 0
# fix repositories align
@ -248,6 +243,8 @@ class BinaryInstall(object):
return [pkg_sum, upg_sum, uni_sum]
def top_view(self):
"""Print packages status bar
"""
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17,
@ -259,8 +256,7 @@ class BinaryInstall(object):
self.msg.template(78)
def store(self, packages):
"""
Store and return packages for install
"""Store and return packages for install
"""
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
# name = data[0]

View file

@ -31,10 +31,8 @@ from slpkg.slack.slack_version import slack_ver
class RepoInit(object):
"""Return PACKAGES.TXT and mirror by repository
"""
Return PACKAGES.TXT and mirror by repository
"""
def __init__(self, repo):
self.repo = repo
self.meta = _meta_

View file

@ -30,8 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def search_pkg(name, repo):
"""
Search if package exists in PACKAGES.TXT file
"""Search if package exists in PACKAGES.TXT file
and return the name.
"""
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"

View file

@ -28,8 +28,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def check_md5(pkg_md5, src_file):
"""
MD5 Checksum
"""MD5 Checksum
"""
if _meta_.checkmd5 in ["on", "ON"]:
print("")

View file

@ -38,8 +38,7 @@ class Config(object):
self.meta = _meta_
def view(self):
"""
View slpkg config file
"""View slpkg config file
"""
print("") # new line at start
conf_args = [
@ -75,8 +74,7 @@ class Config(object):
print("") # new line at end
def edit(self):
"""
Edit configuration file
"""Edit configuration file
"""
subprocess.call("{0} {1}".format(self.meta.editor,
self.config_file), shell=True)

View file

@ -33,8 +33,7 @@ class FileSize(object):
self.registry = registry
def server(self):
"""
Returns the size of remote files
"""Returns the size of remote files
"""
try:
tar = urllib2.urlopen(self.registry)
@ -44,7 +43,6 @@ class FileSize(object):
return " "
def local(self):
"""
Returns the size of local files
"""Returns the size of local files
"""
return os.path.getsize(self.registry)

View file

@ -29,8 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def pkg_checksum(binary, repo):
"""
Return checksum from CHECKSUMS.md5 file by repository
"""Return checksum from CHECKSUMS.md5 file by repository
"""
md5 = "None"
if repo == "slack_patches" and _meta_.slack_rel == "stable":

View file

@ -30,8 +30,7 @@ from slpkg.pkg.find import find_package
def write_deps(deps_dict):
"""
Write dependencies in a log file
"""Write dependencies in a log file
into directory `/var/log/slpkg/dep/`
"""
for name, dependencies in deps_dict.iteritems():

View file

@ -26,7 +26,8 @@ import hashlib
def md5(source):
"""Return MD5 Checksum"""
"""Return MD5 Checksum
"""
with open(source) as file_to_check:
data = file_to_check.read()
return hashlib.md5(data).hexdigest()

View file

@ -28,8 +28,7 @@ from slpkg.splitting import split_package
def find_package(find_pkg, directory):
"""
Find packages
"""Find packages
"""
pkgs = []
if os.path.isdir(directory):

View file

@ -28,8 +28,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def delete_package(path, packages):
"""
Remove downloaded packages
"""Remove downloaded packages
"""
if _meta_.del_all in ["on", "ON"]:
for pkg in packages:

View file

@ -28,10 +28,8 @@ from slpkg.__metadata__ import MetaData as _meta_
class RepoList(object):
"""List of repositories
"""
List of repositories
"""
def __init__(self):
self.meta = _meta_
self.msg = Msg()
@ -40,8 +38,7 @@ class RepoList(object):
self.all_repos.update(Repo().custom_repository())
def repos(self):
"""
View or enabled or disabled repositories
"""View or enabled or disabled repositories
"""
def_cnt, cus_cnt = 0, 0
print("")

View file

@ -36,8 +36,7 @@ from slpkg.sbo.greps import SBoGrep
def sbo_upgrade(skip, flag):
"""
Return packages for upgrade
"""Return packages for upgrade
"""
Msg().checking()
upgrade_names = []
@ -59,8 +58,7 @@ def sbo_upgrade(skip, flag):
def sbo_list():
"""
Return all SBo packages
"""Return all SBo packages
"""
sbo_packages = []
for pkg in os.listdir(_meta_.pkg_path):

View file

@ -27,8 +27,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class SBoGrep(object):
"""
Grab data from SLACKBUILDS.TXT file
"""Grab data from SLACKBUILDS.TXT file
"""
def __init__(self, name):
self.name = name
@ -73,6 +72,8 @@ class SBoGrep(object):
return self._select_source_arch(source, source64)
def _select_source_arch(self, source, source64):
"""Return sources by arch
"""
src = ""
if self.meta.arch == "x86_64":
if source64:
@ -124,6 +125,8 @@ class SBoGrep(object):
return self._select_md5sum_arch(md5sum, md5sum64)
def _select_md5sum_arch(self, md5sum, md5sum64):
"""Return checksums by arch
"""
md5 = ""
if self.meta.arch == "x86_64":
if md5sum64:

View file

@ -32,25 +32,21 @@ class ReadSBo(object):
self.sbo_url = sbo_url
def readme(self, sbo_readme):
"""
Read SlackBuild README file
"""Read SlackBuild README file
"""
return URL(self.sbo_url + sbo_readme).reading()
def info(self, name, sbo_file):
"""
Read info file
"""Read info file
"""
return URL(self.sbo_url + name + sbo_file).reading()
def slackbuild(self, name, sbo_file):
"""
Read SlackBuild file
"""Read SlackBuild file
"""
return URL(self.sbo_url + name + sbo_file).reading()
def doinst(self, doinst_sh):
"""
Read SlackBuild doinst.sh
"""Read SlackBuild doinst.sh
"""
return URL(self.sbo_url + doinst_sh).reading()

View file

@ -29,8 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def delete(build_folder):
"""
Delete build directory and all its contents.
"""Delete build directory and all its contents.
"""
if _meta_.del_build in ["on", "ON"] and os.path.exists(build_folder):
shutil.rmtree(build_folder)

View file

@ -23,8 +23,7 @@
def units(comp_sum, uncomp_sum):
"""
Calculate package size
"""Calculate package size
"""
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)

View file

@ -35,8 +35,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def it_self_update():
"""
Check from GitHub slpkg repository if new version is available
"""Check from GitHub slpkg repository if new version is available
download and update itself
"""
__new_version__ = ""

View file

@ -39,8 +39,7 @@ from slpkg.binary.dependency import Dependencies
class TrackingDeps(object):
"""
View tree of dependencies and also
"""View tree of dependencies and also
highlight packages with color green
if already installed and color red
if not installed.

View file

@ -35,8 +35,7 @@ class URL(object):
self.meta = _meta_
def reading(self):
"""
Open url and read
"""Open url and read
"""
try:
f = urllib2.urlopen(self.link)

View file

@ -40,8 +40,7 @@ class Utils(object):
return dictionary
def dimensional_list(self, lists):
"""
Create one dimensional list
"""Create one dimensional list
"""
one_list = []
for lst in lists:
@ -49,8 +48,7 @@ class Utils(object):
return one_list
def remove_dbs(self, double):
"""
Remove double item from list
"""Remove double item from list
"""
one = []
for dup in double:
@ -59,8 +57,7 @@ class Utils(object):
return one
def read_file(self, registry):
"""
Returns reading file
"""Returns reading file
"""
with open(registry, "r") as file_txt:
read_file = file_txt.read()
@ -68,8 +65,7 @@ class Utils(object):
return read_file
def package_name(self, PACKAGES_TXT):
"""
Returns list with all the names of packages repository
"""Returns list with all the names of packages repository
"""
packages = []
for line in PACKAGES_TXT.splitlines():
@ -78,8 +74,7 @@ class Utils(object):
return packages
def check_downloaded(self, path, maybe_downloaded):
"""
Check if files downloaded and return downloaded
"""Check if files downloaded and return downloaded
packages
"""
downloaded = []
@ -89,8 +84,7 @@ class Utils(object):
return downloaded
def read_config(self, config):
"""
Read config file and returns first uncomment line
"""Read config file and returns first uncomment line
and stop. Used for Slackware mirrors
"""
for line in config.splitlines():