Skip to content

Commit

Permalink
Merge pull request #58 from JensTimmerman/master
Browse files Browse the repository at this point in the history
fix attribute error for uknown attributes in the vsc_setup_klass
  • Loading branch information
stdweird committed Oct 11, 2016
2 parents c7c58e8 + cafaa25 commit 4f77db4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/vsc/install/shared_setup.py
Expand Up @@ -146,7 +146,7 @@ def _log(self, level, msg, args):

RELOAD_VSC_MODS = False

VERSION = '0.10.16'
VERSION = '0.10.17'

log.info('This is (based on) vsc.install.shared_setup %s' % VERSION)

Expand Down Expand Up @@ -1225,9 +1225,12 @@ def parse_target(self, target, urltemplate=None):
new_target.update(vsc_setup_klass.SHARED_TARGET)

# update the cmdclass with ones from vsc_setup_klass
# cannot do this in one go, whne SHARED_TARGET is defined, vsc_setup doesn't exist yet
# cannot do this in one go, when SHARED_TARGET is defined, vsc_setup doesn't exist yet
for name, klass in new_target['cmdclass'].items():
new_target['cmdclass'][name] = getattr(vsc_setup_klass, klass.__name__)
try:
new_target['cmdclass'][name] = getattr(vsc_setup_klass, klass.__name__)
except AttributeError:
del new_target['cmdclass'][name]

# prepare classifiers
classifiers = new_target.setdefault('classifiers', [])
Expand Down
19 changes: 18 additions & 1 deletion test/shared_setup.py
Expand Up @@ -27,7 +27,7 @@
import re

from vsc.install import shared_setup
from vsc.install.shared_setup import action_target, vsc_setup
from vsc.install.shared_setup import action_target, vsc_setup, _fvs

from vsc.install.testing import TestCase

Expand Down Expand Up @@ -167,3 +167,20 @@ def test_prepare_rpm(self):
setup.REPO_LIB_DIR = libdir
setup.prepare_rpm(package)
self.assertEqual(setup.SHARED_TARGET['packages'], ['vsc', 'vsc.test'])

def test_parse_target(self):
"""Test for parse target"""
package = {
'name': 'vsc-test',
'excluded_pkgs_rpm': [],
}
setup = vsc_setup()
klass = _fvs('vsc_bdist_rpm egg_info')
# test to see if we don't fail on unknown/new cmdclasses
orig_target = klass.SHARED_TARGET
klass.SHARED_TARGET['cmdclass']['easy_install'] = object
new_target = setup.parse_target(package)
self.assertEquals(new_target['name'], 'vsc-test')
klass.SHARED_TARGET = orig_target


0 comments on commit 4f77db4

Please sign in to comment.