예제 #1
0
class test_StringVar(unittest.TestCase):
    """ verify functionality of the StringVar variable class
    """
    def setUp(self):
        self.svar = StringVar('name', 'description')

    def testValidation(self):
        """ check to see that validation returns appropriate values:
                string should have no spaces at front or back
                unicode strings and regular strings should pass through
                unchanged non-string values raise validation errors
        """
        val = 'george'
        self.assertEqual(val, self.svar.validate(val))

        val = u'george'
        self.assertEqual(val, self.svar.validate(val))

        val = ' hello '
        validated = self.svar.validate(val)
        self.assertNotEqual(validated[0], ' ')
        self.assertNotEqual(validated[-1], ' ')
        self.assertTrue(validated in val)

        for val in (0, True):
            self.assertRaises(ValidationException, self.svar.validate, val)
예제 #2
0
파일: test_vars.py 프로젝트: Vinsurya/Plone
class test_StringVar(unittest.TestCase):
    """ verify functionality of the StringVar variable class
    """

    def setUp(self):
        self.svar = StringVar('name', 'description')

    def testValidation(self):
        """ check to see that validation returns appropriate values:
                string should have no spaces at front or back
                unicode strings and regular strings should pass through
                unchanged non-string values raise validation errors
        """
        val = 'george'
        self.assertEqual(val, self.svar.validate(val))

        val = u'george'
        self.assertEqual(val, self.svar.validate(val))

        val = ' hello '
        validated = self.svar.validate(val)
        self.assertNotEqual(validated[0], ' ')
        self.assertNotEqual(validated[-1], ' ')
        self.assertTrue(validated in val)

        for val in (0, True):
            self.assertRaises(ValidationException, self.svar.validate, val)
예제 #3
0
class DiazoTheme(BasicZope):
    _template_dir = 'templates/diazotheme'
    summary = "Diazo Theme package with css and js resources"
    help = """
"""
    category = "Plone Development"
    required_templates = []
    use_local_commands = False
    use_cheetah = True
    vars = copy.deepcopy(BasicZope.vars)
    vars.insert(1, StringVar(
        'title',
        title='Project Title',
        description='Title of the project',
        modes=(EASY, EXPERT),
        default='Example Name',
        help="""
This becomes the title of the project. It is used in the
GenericSetup registration for the project and, as such, appears
in Plone's Add/Remove products form.
""",
    ))

    def pre(self, command, output_dir, vars):
        super(DiazoTheme, self).pre(command, output_dir, vars)
        vars['author'] = 'Markus Hilbert'
        vars['author_email'] = '*****@*****.**'
        vars['url'] = 'http://akbild.ac.at'
        vars['include_doc'] = True
예제 #4
0
class SinarPlone(BasicZope):
    _template_dir = 'templates/sinar_plone'
    summary = 'A comprehensive Plone package for Sinar projects'
    help = '''
This template support local commands. These commands allow you 
to generate skeleton contenttype, behavior, upgrade profiles, 
schemaextender, etc, etc. All that common in Sinar's line of
work
'''
    post_run_msg = LOCAL_COMMANDS_MESSAGE
    category = 'Plone Development'
    use_cheetah = True
    use_local_commands = True
    required_templates = []
    default_required_structures = []
    vars = copy.deepcopy(BasicZope.vars)
    vars.insert(1, StringVar(
        'title',
        title='Project Title',
        description='Title of the project',
        modes=(EASY, EXPERT),
        default='Example Name',
        help="""
This becomes the title of the project. It is used in the
GenericSetup registration for the project and, as such, appears
in Plone's Add/Remove products form.
""",
    ))

    def pre(self, command, output_dir, vars):
        super(SinarPlone, self).pre(command, output_dir, vars)
        vars['use_localcommands'] = self.use_local_commands
        vars['author'] = 'Sinar Project'
        vars['author_email'] = '*****@*****.**'
        vars['url'] = 'http://github.com/sinar'
예제 #5
0
class FrontEndBuildout(Buildout):

    summary = "Create a Frontend buildout with Nginx, Varnish and Repoze"
    help = """This template creates a buildout for a frontend server running
              Nginx, Varnishm Repoze.
           """

    required_templates = []
    _template_dir = "templates/frontend_buildout"

    vars = [
        StringVar(
            'url',
            'URL (without http://)',
            default='',
            modes=(EASY, EXPERT),
        )
    ]

    def gen_seed(self, size=19):
        ''' Generate a seed to the cookie mechanism '''
        seed = [choice(BASE) for i in range(0, size)]
        return ''.join(seed)

    def check_vars(self, vars, cmd):
        resp = super(FrontEndBuildout, self).check_vars(vars, cmd)
        resp['seed'] = self.gen_seed()
        return resp
예제 #6
0
class PlonePackage(NestedPackage):

    summary = "A Plone package template for Simples Consultoria's projects"
    help = """This is a base template for Simples Consultoria's Plone projects
              that use a nested namespace (two dots in the name).
              """

    category = "Simples Consultoria - Plone"

    _template_dir = "templates/plone_package"

    default_required_structures = ['bootstrap',
                                   'egg_docs_ex',
                                   'plone_testing_base',
                                   'plone_package'
                                   ]

    vars = copy.deepcopy(base_vars())

    vars.extend(copy.deepcopy(gs_vars))

    vars.append(
        StringVar(
            'plone_version',
            'Plone version',
            default='4.1',
            modes=(EASY, EXPERT),
           )
    )

    get_var(vars, 'keywords').default = 'python plone zope simples_consultoria'

    def add_plone_testing(self, version):
        ''' Adds the default testing configuration for the package '''

        def sanitize(version):
            version = version[:3].replace('.', '')
            return version

        structure = 'plone_testing_%s' % sanitize(version)
        if self.has_structure(structure):
            self.required_structures.append(structure)

    def has_profile(self, resp):
        ''' Return true if we have any GS profile '''
        return (resp.get('add_profile',False) or
                resp.get('add_profile_uninstall',False) or
                resp.get('add_profile_init_content',False))

    def check_vars(self, vars, cmd):
        resp = super(PlonePackage, self).check_vars(vars, cmd)
        self.add_plone_testing(resp['plone_version'])
        resp['has_profile'] = self.has_profile(resp)
        resp['add_profile_init_content'] = resp.get('add_profile_init_content',
                                                    False)
        return resp
예제 #7
0
class PloneBuildout(Buildout):

    summary = "Create a Plone buildout"
    help = """This template allows you to create a Plone buildout"""

    required_templates = []
    _template_dir = "templates/plone_buildout"

    vars = [
        StringVar(
            'plone_version',
            'Plone version',
            default='4.1',
            modes=(EASY, EXPERT),
        )
    ]
예제 #8
0
 def setUp(self):
     """ set up some basics for the coming tests
     """
     self.vars = [
         var('basic_var', 'This is a basic variable',
             title="Basic Title", default="foo",
             modes=(EXPERT, EASY)),
         BooleanVar('bool_var', 'This is a boolean variable',
                    title="Boolean Title", default=False, page='Main',
                    modes=(EASY)),
         StringVar('str_var', 'This is a string variable',
                   title="String Title", default="string", page='Carl',
                   modes=(EXPERT)),
         TextVar('txt_var', 'This is a text variable', page='Martin',
                 title="Text Title", default="text",
                 modes=()),
         DottedVar('dot_var', 'This is a dotted variable',
                   title="Dotted Title", default="dotted.variable")]
     self.template = BaseTemplate('my_name')
     create = get_commands()['create'].load()
     command = create('create')
     command.parse_args(['-t', 'nested_namespace'])
     self.command = command
예제 #9
0
class Dexterity(Plone):
    _template_dir = 'templates/dexterity'
    summary = 'A Plone project that uses Dexterity content types'
    help = HELP_TEXT
    post_run_msg = POST_RUN_TEXT
    required_templates = ['plone_basic']
    default_required_structures = [
        'egg_docs',
        'bootstrap',
    ]
    category = "Plone Development"
    use_cheetah = True
    use_local_commands = SUPPORTS_LOCAL_COMMANDS

    vars = copy.deepcopy(Plone.vars)
    vars.insert(
        1,
        StringVar(
            'title',
            title='Project Title',
            description='Title of the project',
            modes=(EASY, EXPERT),
            default='Example Name',
            help="""
This becomes the title of the project. It is used in the
GenericSetup registration for the project and, as such, appears
in Plone's Add/Remove products form.
""",
        ))
    #add_profile should always default to True for dexterity packages
    get_var(vars, 'add_profile').default = True
    #add_profile need not appear as a question for dexterity packages
    get_var(vars, 'add_profile').modes = (EXPERT, )

    def pre(self, command, output_dir, vars):
        super(Dexterity, self).pre(command, output_dir, vars)
        vars['use_localcommands'] = self.use_local_commands
예제 #10
0
파일: test_vars.py 프로젝트: Vinsurya/Plone
 def setUp(self):
     self.svar = StringVar('name', 'description')
예제 #11
0
class ProjectDocumentation(BaseTemplate):

    summary = "Create a Sphinx Documentation for a project."
    help = """This template creates a documentation for a project following
              Simples Consultoria's standards.
           """

    category = "Simples Consultoria - Documentation"

    ndots = 0
    use_cheetah = True

    required_templates = []
    default_required_structures = [
        'sphinx_base',
    ]
    _template_dir = "templates/project_docs"

    vars = copy.deepcopy(BaseTemplate.vars)
    vars += [
        StringVar(
            'title',
            title='Project Title',
            description="""A meaningful title for this project.""",
            default='Customer Project',
            modes=(EASY, EXPERT),
            page='Metadata',
            help="""It could be something like: Vogon Poetry Co. Intranet"""),
        StringVar('description',
                  title='Description',
                  description='One-line description of the project',
                  default='Project developed by Simples Consultoria',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""Description of this documentation."""),
        StringVar('version',
                  title='Version',
                  description='Version number for project',
                  modes=(EASY, EXPERT),
                  default=gen_version(show_minor=False),
                  page='Metadata',
                  help="""Version number"""),
        StringVar('author',
                  title='Author',
                  description='Name of author for project',
                  default=D.get('author'),
                  modes=(),
                  page='Metadata',
                  help="""Name that will appear on the theme description"""),
        StringVar('author_email',
                  title='Author Email',
                  description='Email of author for project',
                  default=D.get('email'),
                  modes=(),
                  page='Metadata',
                  help="""Email of the author of the documentation."""),
        StringVar('language',
                  title='Language',
                  description='Documentation Language',
                  modes=(EXPERT, ),
                  default='pt_BR',
                  page='Metadata',
                  help="""What is the language for this documentation?"""),
    ]

    def check_vars(self, vars, cmd):
        resp = super(ProjectDocumentation, self).check_vars(vars, cmd)
        resp['year'] = year()
        return resp
예제 #12
0
class PackageTemplate(BaseTemplate):
    _template_dir = 'templates/basic_namespace'
    summary = "A Python package template for templer"
    help = """
This creates a Python project without any Zope or Plone features.
"""
    category = "Core Python"

    required_templates = []
    default_required_structures = [
        'egg_docs',
    ]
    use_cheetah = True

    vars = copy.deepcopy(BaseTemplate.vars)
    vars += [
        DottedVar('egg',
                  title='Package',
                  description='Package name (for namespace support use dots.)',
                  default='',
                  modes=(EASY, ),
                  page='Namespaces',
                  help="""
Choose the name of your package.

If you want to use dots in the package name (namespaces), just provide them
directly in the name. For example: my.package.
            """),
        StringVar('version',
                  title='Version',
                  description='Version number for project',
                  default='1.0',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This becomes the version number of the created package. It will be set
in the egg's setup.py, and may be referred to in other places in the
generated project.
"""),
        StringVar('description',
                  title='Description',
                  description='One-line description of the project',
                  default='',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This should be a single-line description of your project. It will be
used in the egg's setup.py, and, for Zope/Plone projects, may be used
in the GenericSetup profile description.
"""),
        TextVar('long_description',
                title='Long Description',
                description='Multi-line description (in ReST)',
                default='',
                modes=(),
                page='Metadata',
                help="""
This should be a full description for your project. It will be
used in the egg's setup.py.

It should be entered in 'restructured text' format; for information,
see http://docutils.sourceforge.net/rst.html).
"""),
        StringVar('author',
                  title='Author',
                  description='Name of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('author_email',
                  title='Author Email',
                  description='Email of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('keywords',
                  title='Keywords',
                  description='List of keywords, space-separated',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the list of keywords for this project. This will be
used in the egg's setup.py (and, if this egg is later published on
PyPI, will be used to categorize the project).
"""),
        StringVar('url',
                  title='Project URL',
                  description='URL of the homepage for this project',
                  modes=(),
                  page='Metadata',
                  default='http://svn.plone.org/svn/collective/',
                  help="""
This should be a URL for the homepage for this project (if applicable).
It will be used in the egg's setup.py.
"""),
        StringChoiceVar('license_name',
                        title='Project License',
                        description='Name of license for the project',
                        default='GPL',
                        modes=(),
                        page='Metadata',
                        choices=LICENSE_CATEGORIES.keys(),
                        structures=LICENSE_DICT,
                        help="""
The license that this project is issued under. It will be used in the
egg's setup.py.

Common choices here are 'GPL' (for the GNU General Public License),
'ZPL' (for the Zope Public License', or 'BSD' (for the BSD license).

%s

""" % BaseTemplate('null').readable_license_options()),
        BooleanVar('zip_safe',
                   title='Zip-Safe?',
                   description=
                   'Can this project be used as a zipped egg? (true/false)',
                   default=False,
                   modes=(),
                   page='Metadata',
                   help="""
Some eggs can be used directly by Python in zipped format; others must
be unzipped so that their contents can be properly used. Zipped eggs
are smaller and may be easier to redistribute.

Most Zope/Plone projects cannot be used in zipped format; if unsure,
the safest answer is False.
            """),
    ]

    def pre(self, command, output_dir, vars):
        #        egg_var = get_var(vars, 'egg')
        #        egg_var = str(egg_var)
        #        vars['segs']
        #        egg_var.split('.')
        #        namespace = []
        #
        #        for i in range(len(vars['segs']) - 1):
        #            namespace.append(".".join(vars['segs'][0:i+1]))
        #
        #        vars['namespace'] = namespace

        super(PackageTemplate, self).pre(command, output_dir, vars)

    def run(self, command, output_dir, vars):
        templates.Template.run(self, command, output_dir, vars)

    def check_vars(self, vars, command):
        if not command.options.no_interactive and \
           not hasattr(command, '_deleted_once'):
            del vars['package']
            command._deleted_once = True
        return super(PackageTemplate, self).check_vars(vars, command)
예제 #13
0
class BasicNamespace(BaseTemplate):
    _template_dir = 'templates/basic_namespace'
    summary = "A basic Python project with a namespace package"
    ndots = 1
    help = """
This creates a Python project without any Zope or Plone features.
"""
    category = "Core Python"

    required_templates = []
    default_required_structures = [
        'egg_docs',
    ]
    use_cheetah = True
    vars = copy.deepcopy(BaseTemplate.vars)
    vars += [
        DottedVar('namespace_package',
                  title='Namespace Package Name',
                  description='Name of outer namespace package',
                  default='my',
                  modes=(EXPERT, ),
                  page='Namespaces',
                  help="""
This is the name of the outer package (Python folder) for this project.
For example, in 'Products.PloneFormGen', this would be 'Products'.
This will often be (for Plone products) 'Products'; it may also be
the name of your company/project, or a common-style name like
(for Plone products) 'collective'.

Note that, for some templates, there may be two namespaces, rather
than one (to create eggs with names like 'plone.app.blog')--in this
case, this would be 'plone', the first of the enclosing namespaces.
            """),
        DottedVar('package',
                  title='Package Name',
                  description='Name of the inner namespace package',
                  default='example',
                  modes=(EXPERT, ),
                  page='Namespaces',
                  help="""
This is the name of the innermost package (Python folder) for this project.
For example, in 'Products.PloneFormGen', this would be 'PloneFormGen'.

Note that, for some templates, there may be only a package name without
a namespace package around it--in this case, this would be just the name
of the package.
"""),
        StringVar('version',
                  title='Version',
                  description='Version number for project',
                  default='1.0',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This becomes the version number of the created package. It will be set
in the egg's setup.py, and may be referred to in other places in the
generated project.
"""),
        StringVar('description',
                  title='Description',
                  description='One-line description of the project',
                  default='',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This should be a single-line description of your project. It will be
used in the egg's setup.py, and, for Zope/Plone projects, may be used
in the GenericSetup profile description.
"""),
        TextVar('long_description',
                title='Long Description',
                description='Multi-line description (in ReST)',
                default='',
                modes=(),
                page='Metadata',
                help="""
This should be a full description for your project. It will be
used in the egg's setup.py.

It should be entered in 'restructured text' format; for information,
see http://docutils.sourceforge.net/rst.html).
"""),
        StringVar('author',
                  title='Author',
                  description='Name of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('author_email',
                  title='Author Email',
                  description='Email of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('keywords',
                  title='Keywords',
                  description='List of keywords, space-separated',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the list of keywords for this project. This will be
used in the egg's setup.py (and, if this egg is later published on
PyPI, will be used to categorize the project).
"""),
        StringVar('url',
                  title='Project URL',
                  description='URL of the homepage for this project',
                  modes=(),
                  page='Metadata',
                  default='http://svn.plone.org/svn/collective/',
                  help="""
This should be a URL for the homepage for this project (if applicable).
It will be used in the egg's setup.py.
"""),
        StringChoiceVar('license_name',
                        title='Project License',
                        description='Name of license for the project',
                        default='GPL',
                        modes=(),
                        page='Metadata',
                        choices=LICENSE_CATEGORIES.keys(),
                        structures=LICENSE_DICT,
                        help="""
The license that this project is issued under. It will be used in the
egg's setup.py.

Common choices here are 'GPL' (for the GNU General Public License),
'ZPL' (for the Zope Public License', or 'BSD' (for the BSD license).

%s

""" % BaseTemplate('null').readable_license_options()),
        BooleanVar('zip_safe',
                   title='Zip-Safe?',
                   description=
                   'Can this project be used as a zipped egg? (true/false)',
                   default=False,
                   modes=(),
                   page='Metadata',
                   help="""
Some eggs can be used directly by Python in zipped format; others must
be unzipped so that their contents can be properly used. Zipped eggs
are smaller and may be easier to redistribute.

Most Zope/Plone projects cannot be used in zipped format; if unsure,
the safest answer is False.
            """),
    ]

    def check_vars(self, vars, command):
        if not command.options.no_interactive and \
           not hasattr(command, '_deleted_once'):
            del vars['package']
            command._deleted_once = True
        return super(BasicNamespace, self).check_vars(vars, command)
예제 #14
0
class PackageTemplate(BaseTemplate):
    _outer_template_dir = 'templates/outer'
    _inner_template_dir = 'templates/inner'
    summary = "A Python package template for templer"
    help = """
This creates a Python project without any Zope or Plone features.
"""
    category = "Core Python"

    required_templates = []
    default_required_structures = [
        'egg_docs',
    ]
    use_cheetah = True

    vars = copy.deepcopy(BaseTemplate.vars)
    vars += [
        DottedVar('egg',
                  title='Package',
                  description='Package name (for namespace support use dots.)',
                  default='',
                  modes=(EASY, ),
                  page='Namespaces',
                  help="""
Choose the name of your package.

If you want to use dots in the package name (namespaces), just provide them
directly in the name. For example: my.package.
            """),
        StringVar('version',
                  title='Version',
                  description='Version number for project',
                  default='1.0',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This becomes the version number of the created package. It will be set
in the egg's setup.py, and may be referred to in other places in the
generated project.
"""),
        StringVar('description',
                  title='Description',
                  description='One-line description of the project',
                  default='',
                  modes=(EASY, EXPERT),
                  page='Metadata',
                  help="""
This should be a single-line description of your project. It will be
used in the egg's setup.py, and, for Zope/Plone projects, may be used
in the GenericSetup profile description.
"""),
        TextVar('long_description',
                title='Long Description',
                description='Multi-line description (in ReST)',
                default='',
                modes=(),
                page='Metadata',
                help="""
This should be a full description for your project. It will be
used in the egg's setup.py.

It should be entered in 'restructured text' format; for information,
see http://docutils.sourceforge.net/rst.html).
"""),
        StringVar('author',
                  title='Author',
                  description='Name of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('author_email',
                  title='Author Email',
                  description='Email of author for project',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""),
        StringVar('keywords',
                  title='Keywords',
                  description='List of keywords, space-separated',
                  modes=(),
                  page='Metadata',
                  help="""
This should be the list of keywords for this project. This will be
used in the egg's setup.py (and, if this egg is later published on
PyPI, will be used to categorize the project).
"""),
        StringVar('url',
                  title='Project URL',
                  description='URL of the homepage for this project',
                  modes=(),
                  page='Metadata',
                  default='http://svn.plone.org/svn/collective/',
                  help="""
This should be a URL for the homepage for this project (if applicable).
It will be used in the egg's setup.py.
"""),
        StringChoiceVar('license_name',
                        title='Project License',
                        description='Name of license for the project',
                        default='GPL',
                        modes=(),
                        page='Metadata',
                        choices=LICENSE_CATEGORIES.keys(),
                        structures=LICENSE_DICT,
                        help="""
The license that this project is issued under. It will be used in the
egg's setup.py.

Common choices here are 'GPL' (for the GNU General Public License),
'ZPL' (for the Zope Public License', or 'BSD' (for the BSD license).

%s

""" % BaseTemplate('null').readable_license_options()),
        BooleanVar('zip_safe',
                   title='Zip-Safe?',
                   description=
                   'Can this project be used as a zipped egg? (true/false)',
                   default=False,
                   modes=(),
                   page='Metadata',
                   help="""
Some eggs can be used directly by Python in zipped format; others must
be unzipped so that their contents can be properly used. Zipped eggs
are smaller and may be easier to redistribute.

Most Zope/Plone projects cannot be used in zipped format; if unsure,
the safest answer is False.
            """),
    ]

    def pre(self, command, output_dir, vars):
        """The namespace string for insertion into setup.py needs to
           be calculated, and inserted into the vars for use in
           setup.py_tmpl.
        """
        if '.' in vars['egg']:
            # Taken from http://code.google.com/p/wsgitemplates/
            namespace = []
            for i in range(len(vars['egg'].split('.')) - 1):
                namespace.append(".".join(vars['egg'].split('.')[0:i + 1]))
            vars['namespace'] = "\n      namespace_packages=%s," % namespace
        else:
            vars['namespace'] = ""

        super(PackageTemplate, self).pre(command, output_dir, vars)

    def post(self, command, output_dir, vars):
        cwd = os.getcwd()
        os.chdir(vars['egg'])
        os.chdir('src')
        for i in range(len(vars['egg'].split('.'))):
            segs = vars['egg'].split('.')[0:i + 1]
            try:
                os.mkdir(os.path.join(*vars['egg'].split('.')[0:i + 1]))
            except OSError:
                pass
            segs.append("__init__.py")
            init = None
            if i != len(vars['egg'].split('.')) - 1:
                init = open(os.path.join(*segs), "w")
                init.write(
                    "__import__('pkg_resources').declare_namespace(__name__)")
            if not init is None:
                init.close()
        os.chdir(cwd)
        super(PackageTemplate, self).post(command, output_dir, vars)

    def run(self, command, output_dir, vars):
        self._template_dir = self._outer_template_dir
        templates.Template.run(self, command, output_dir, vars)
        output_dir = os.path.join(*([vars['egg'], 'src'] +
                                    vars['egg'].split('.')))

        self._template_dir = self._inner_template_dir
        _old_required_structures = self.required_structures
        self.required_structures = []
        templates.Template.run(self, command, output_dir, vars)
        self.required_structures = _old_required_structures

    def check_vars(self, vars, command):
        if not command.options.no_interactive and \
           not hasattr(command, '_deleted_once'):
            del vars['package']
            command._deleted_once = True
        return super(PackageTemplate, self).check_vars(vars, command)
예제 #15
0
 def setUp(self):
     self.svar = StringVar('name', 'description')