[Blends-commit] [SCM] website branch, master, updated. d2dbc2cbba010c14db1a2af1c3ca8b8ba49eff72

Ole Streicher ole at aip.de
Fri Apr 29 14:27:03 UTC 2016


The following commit has been merged in the master branch:
commit d0d1b6291bff5e93b983cbeece4781360a516519
Author: Ole Streicher <ole at aip.de>
Date:   Fri Apr 29 16:15:22 2016 +0200

    Remove redundant 'dep is None' tests

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 04d0dbf..c889c33 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -1201,115 +1201,70 @@ class TaskDependencies:
                 if key == 'Homepage':
                     if fields_duplicated is not None:
                         fields_duplicated.append(key)
-                    if dep is not None:
-                        # set Homepage only if not just set via official package information
-                        if dep.properties['homepage'] == HOMEPAGENONE:
-                            dep.properties['homepage'] = stanza['homepage']
-                        else:
-                            fields_obsolete.append(key)
+                    # set Homepage only if not just set via official package information
+                    if dep.properties['homepage'] == HOMEPAGENONE:
+                        dep.properties['homepage'] = stanza['homepage']
                     else:
-                        logger.error("Dep not initiated before Homepage %s -> something is wrong."
-                                     % stanza['homepage'])
+                        fields_obsolete.append(key)
                 elif key.lower() in ('vcs-svn', 'vcs-git'):
-                    if dep is not None:
-                        vcs = dep.properties.setdefault('vcs', {})
-                        vcs['url']  = stanza[key.lower()]
-                        vcs['type'] = key.split('-')[1].capitalize()
-                        if 'browser' not in vcs:
-                            try:
-                                vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
-                            except KeyError as err:
-                                logger.error("Vcs Property missing in packages file:", vcs, err)
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    vcs = dep.properties.setdefault('vcs', {})
+                    vcs['url']  = stanza[key.lower()]
+                    vcs['type'] = key.split('-')[1].capitalize()
+                    if 'browser' not in vcs:
+                        try:
+                            vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
+                        except KeyError as err:
+                            logger.error("Vcs Property missing in packages file:", vcs, err)
                     if dep.properties['pkgstatus'] == 'unknown':
                         dep.properties['pkgstatus'] = 'pkgvcs'
                 elif key.lower() == 'vcs-browser':
-                    if dep is not None:
-                        vcs = dep.properties.setdefault('vcs', {})
-                        vcs['browser'] = stanza['vcs-browser']
-                        if re.compile("[/.]git\.").search(vcs['browser']):
-                            vcs['type'] = 'Git'
-                        elif re.compile("[/.]svn\.").search(vcs['browser']):
-                            vcs['type'] = 'Svn'
-                        else:
-                            # no chance to guess Vcs type
-                            vcs['type'] = 'Vcs'
-                        # There is no need to specify the Vcs-{Git,SVN} field in the tasks file but property 'vcs-type' should be set in
-                        # any case - so set it here in case it was not set before.  If an apropriate field is set later it becomes
-                        # overriden anyway
-                        if 'url' not in vcs:
-                            vcs['url'] = vcs['browser']
+                    vcs = dep.properties.setdefault('vcs', {})
+                    vcs['browser'] = stanza['vcs-browser']
+                    if re.compile("[/.]git\.").search(vcs['browser']):
+                        vcs['type'] = 'Git'
+                    elif re.compile("[/.]svn\.").search(vcs['browser']):
+                        vcs['type'] = 'Svn'
                     else:
-                        logger.error("Dep not initiated before Vcs-Browser %s -> something is wrong."
-                                     % stanza['vcs-browser'])
+                        # no chance to guess Vcs type
+                        vcs['type'] = 'Vcs'
+                    # There is no need to specify the Vcs-{Git,SVN} field in the tasks file but property 'vcs-type' should be set in
+                    # any case - so set it here in case it was not set before.  If an apropriate field is set later it becomes
+                    # overriden anyway
+                    if 'url' not in vcs:
+                        vcs['url'] = vcs['browser']
                     if dep.properties['pkgstatus'] == 'unknown':
                         dep.properties['pkgstatus'] = 'pkgvcs'
                 elif key == 'section':
-                    if dep is not None:
-                        dep.properties[key.lower()]  = stanza[key.lower()]
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    dep.properties[key.lower()]  = stanza[key.lower()]
                 elif key == 'License':
-                    if dep is not None:
-                        dep.properties[key.lower()]  = stanza[key.lower()]
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    dep.properties[key.lower()]  = stanza[key.lower()]
                 elif key == 'Language':
-                    if dep is not None:
-                        dep.properties[key.lower()]  = stanza[key.lower()]
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    dep.properties[key.lower()]  = stanza[key.lower()]
                 elif key == 'Registration':
-                    if dep is not None:
-                        dep.properties[key.lower()]  = stanza[key.lower()]
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    dep.properties[key.lower()]  = stanza[key.lower()]
                 elif key.startswith('Published-'):
-                    if dep is not None:
-                        if 'published' not in dep.properties:
-                            dep.properties['published'] = {}
-                        ptype = key.replace('Published-', '').lower()
-                        dep.properties['published'][ptype] = stanza[key.lower()]
-                    else:
-                        logger.error("Dep not initiated before %s %s -> something is wrong."
-                                     % (key, stanza[key.lower()]))
+                    if 'published' not in dep.properties:
+                        dep.properties['published'] = {}
+                    ptype = key.replace('Published-', '').lower()
+                    dep.properties['published'][ptype] = stanza[key.lower()]
                 elif key == 'WNPP':
-                    if dep is not None:
-                        wnpp = stanza['wnpp'].strip()
-                        # in case somebody prepended a '#' sign before the bug number
-                        wnpp = re.sub('^#', '', wnpp)
-                        # if there is really a number given
-                        if re.compile("^\d+$").search(wnpp):
-                            dep.properties['wnpp'] = wnpp
-                    else:
-                        logger.error("Dep not initiated before WNPP %s -> something is wrong."
-                                     % stanza['wnpp'])
+                    wnpp = stanza['wnpp'].strip()
+                    # in case somebody prepended a '#' sign before the bug number
+                    wnpp = re.sub('^#', '', wnpp)
+                    # if there is really a number given
+                    if re.compile("^\d+$").search(wnpp):
+                        dep.properties['wnpp'] = wnpp
                 elif key.lower() == 'pkg-url':
-                    if dep is not None:
-                        if dep.properties['pkg-url'] == HOMEPAGENONE:  # only if no official package is just available
-                            dep.properties['pkg-url'] = stanza['pkg-url']
-                    else:
-                        logger.error("Dep not initiated before Pkg-URL %s -> something is wrong."
-                                     % stanza['pkg-url'])
+                    if dep.properties['pkg-url'] == HOMEPAGENONE:  # only if no official package is just available
+                        dep.properties['pkg-url'] = stanza['pkg-url']
                 elif key == 'Pkg-Description':
-                    if dep is None:
-                        logger.error("Dep not initiated before Pkg-Description %s -> something is wrong."
-                                     % stanza['pkg-description'].splitlines()[0])
+                    # Only update use description from task file if not known from official package
+                    if dep.properties['desc']['en'] == {}:
+                        (shortDesc, longDesc) = SplitDescription(stanza['pkg-description'])
+                        dep.properties['desc']['en']['short'] = shortDesc
+                        dep.properties['desc']['en']['long']  = longDesc
                     else:
-                        # Only update use description from task file if not known from official package
-                        if dep.properties['desc']['en'] == {}:
-                            (shortDesc, longDesc) = SplitDescription(stanza['pkg-description'])
-                            dep.properties['desc']['en']['short'] = shortDesc
-                            dep.properties['desc']['en']['long']  = longDesc
-                        else:
-                            fields_obsolete.append(key)
-                            continue
+                        fields_obsolete.append(key)
                 elif key == 'Avoid' or key == 'Ignore':
                     dep.properties['pkgstatus'] = key.lower()
                 elif key == 'Remark':
@@ -1318,7 +1273,6 @@ class TaskDependencies:
                         remark['short'] = shortDesc
                     if longDesc:
                         remark['long'] = longDesc
-                    continue
                 else:
                     if key not in KEYSTOIGNORE:
                         # Also ignore keys starting with X[A-Z]-

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list