Commits

Lynn Rees committed 554c80e

- infrastructure

  • Participants
  • Parent commits 2ab98b4

Comments (0)

Files changed (9)

appspace/__init__.py

 # -*- coding: utf-8 -*-
 '''appspace'''
 
+from appspace.keys import appifies
 from appspace.registry import Registry
 from appspace.keys import NoAppError, AppLookupError
 from appspace.builders import patterns, class_patterns
 from appspace.spaces import Branch, Namespace, Patterns, include
 
-__version__ = (0, 5, 3)
+__version__ = (0, 5, 4)

appspace/managers.py

 '''appspace management'''
 
 import re
-import unicodedata
+from unicodedata import normalize
 
 from stuf.six import u
 
 __all__ = ('Manager', 'StrictManager')
 
 
-class RootMixin(object):
+class ManagerMixin(object):
 
     '''state manager'''
 
         normalizes string, converts to lowercase, removes non-alpha characters,
         and converts spaces to hyphens
         '''
-        value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
-        return cls._second('-', u(cls._first('', value).strip().lower()))
+        return cls._second('-', u(cls._first(
+            '', normalize('NFKD', value).encode('ascii', 'ignore')
+        ).strip().lower()))
 
 
 @appifies(AManager)
-class Manager(RootMixin, Registry):
+class Manager(ManagerMixin, Registry):
 
     '''state manager'''
 
-    __slots__ = ('_current', '_root', '_key', '_first', '_second')
+    __slots__ = ('_current', '_root', '_key')
 
 
 @appifies(AManager)
-class StrictManager(RootMixin, StrictRegistry):
+class StrictManager(ManagerMixin, StrictRegistry):
 
     '''strict manager'''
 
-    __slots__ = ('_current', '_root', '_key', '_first', '_second')
+    __slots__ = ('_current', '_root', '_key')
 
 
 keyed = Manager.keyed

appspace/registry.py

         '''
         init
 
-        @param path: path to component module
+        @param path: path to component
         '''
         self.path = path
 
     def __repr__(self):
-        return 'lazy import from {path}'.format(path=self.path)
+        return 'lazy import from {}'.format(self.path)
 
 
 class RegistryMixin(object):

appspace/spaces.py

 from itertools import starmap
 
 from stuf.six import strings
-from stuf.utils import selfname, exhaust, twoway, exhaustmap
+from stuf.utils import selfname, exhaust, exhaustmap, twoway
 
 from appspace.utils import lazyimport
 from appspace.managers import Manager, StrictManager
             key = lazyimport(key)
         manager = cls._manager(l, key)  # pylint: disable-msg=e1121
         b = partial(manager.keyed, ABranch)
-        n = partial(manager.keyed, ANamespace)
-        m = manager.set
+        m, n = manager.set, partial(manager.keyed, ANamespace)
         t = lambda x, y: y.build(manager) if (n(y) or b(y)) else m(y, x, l)
         exhaustmap(vars(cls), t, cls._filter)
         return manager
     def build(cls, manager):
         '''gather branch configuration'''
         cls._key(selfname(cls), manager)
-        i = cls.include
-        m = manager.set
+        i, m = cls.include, manager.set
         t = lambda x: not x[0].startswith('_') or isinstance(x[1], strings)
         exhaustmap(vars(cls), lambda x, y: m(i(y), x), t)
 
         '''gather namespace configuration'''
         label = selfname(cls)
         cls._key(label, manager)
-        m = manager.set
-        n = partial(manager.keyed, ANamespace)
+        m, n = manager.set, partial(manager.keyed, ANamespace)
         t = lambda k, v: v.build(manager) if n(v) else m(v, k, label)
         exhaustmap(vars(cls), t, cls._filter)
 

appspace/utils.py

 
 class CheckName(object):
 
-    '''ensures string is a legal Python name'''
+    '''ensures string is legal Python name'''
 
     # Illegal characters for Python names
     ic = '()[]{}@,:`=;+*/%&|^><\'"#\\$?!~'
 
     def __call__(self, name):
         '''
-        ensures a string is a legal python name
+        ensures string is legal python name
 
         @param name: name to check
         '''
     local('hg merge next; hg ci -m automerge')
     local('hg update pu')
     local('hg merge default; hg ci -m automerge')
-    prompt('Enter tag', 'tag')
+    prompt('Enter tag: ', 'tag')
     with settings(warn_only=True):
         local('hg tag "%(tag)s"' % env)
         local('hg push ssh://hg@bitbucket.org/lcrees/appspace')
         local('hg push git+ssh://git@github.com:kwarterthieves/appspace.git')
-#    local('python setup.py register sdist --format=bztar,gztar,zip upload')
+    local('./setup.py register sdist --format=bztar,gztar,zip upload')
+    local('rm -rf dist')
+
+
+def release_next():
+    '''release appspace from next branch'''
+    local('hg update maint')
+    local('hg merge default; hg ci -m automerge')
+    local('hg update default')
+    local('hg merge next; hg ci -m automerge')
+    local('hg update next')
+    local('hg merge default; hg ci -m automerge')
+    prompt('Enter tag: ', 'tag')
+    with settings(warn_only=True):
+        local('hg tag "%(tag)s"' % env)
+        local('hg push ssh://hg@bitbucket.org/lcrees/appspace')
+        local('hg push git+ssh://git@github.com:kwarterthieves/appspace.git')
+    local('./setup.py register sdist --format=bztar,gztar,zip upload')
+    local('rm -rf dist')
+zope.interface>=3.8.0
+stuf>=0.8.12
+#! /usr/bin/env python
 # -*- coding: utf-8 -*-
-'''setup appspace'''
+'''setup for appspace'''
 
-import os
 import sys
-
+from os import getcwd
+from os.path import join
 try:
     from setuptools import setup
 except ImportError:
     from distutils.core import setup
+    
+from appspace import __version__
 
-install_requires = ['zope.interface>=3.8.0', 'stuf>=0.8.8']
+install_requires = list(l for l in open(
+    join(getcwd(), 'requirements.txt'), 'r',
+).readlines())
 if sys.version_info[0] == 2 and sys.version_info[1] < 7:
     install_requires.extend(['importlib'])
 
 setup(
     name='appspace',
-    version='0.5.3',
+    version='{}.{}.{}'.format(*__version__),
     description='easy application construction with easy building blocks',
     long_description=open(os.path.join(os.getcwd(), 'README.rst'), 'r').read(),
+    keywords='component architecture injection aspect-oriented',
+    license='BSD',
     author='L. C. Rees',
-    author_email='lcrees@gmail.com',
-    license='MIT',
+    author_email='lcrees@gmail.com',
     url='https://bitbucket.org/lcrees/appspace',
     packages=['appspace'],
     test_suite='appspace.tests',
-    zip_safe=False,
-    keywords='component architecture injection aspect-oriented',
+    zip_safe=False,
+    install_requires=install_requires,
     classifiers=[
         'Development Status :: 4 - Beta',
         'Intended Audience :: Developers',
-        'License :: OSI Approved :: MIT License',
+        'License :: OSI Approved :: BSD License',
         'Natural Language :: English',
         'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2.6',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.2',
-        'Programming Language :: Python :: Implementation :: CPython',
-        'Programming Language :: Python :: Implementation :: PyPy',
-        'Programming Language :: Python',
-        'Topic :: Software Development :: Libraries',
-        'Topic :: Software Development',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 2.6',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.2',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Topic :: Software Development',
+        'Topic :: Software Development :: Libraries',
         'Topic :: Utilities',
     ],
-    install_requires=install_requires,
 )
   nose
   coverage
 commands=
-  nosetests {posargs:--with-coverage}
+  nosetests {posargs:--with-coverage --cover-package=appspace}
   
 [testenv:py26]
 deps=
   nose
   coverage
 commands=
-  nosetests {posargs:--with-coverage}
+  nosetests {posargs:--with-coverage --cover-package=appspace}