comparison makeitso/python.py @ 177:c3f719824948

more allowable
author Jeff Hammel <k0scist@gmail.com>
date Fri, 24 Jan 2014 11:03:05 -0800
parents 54f42aa651bc
children d6ef91d49609
comparison
equal deleted inserted replaced
176:668b01d04457 177:c3f719824948
18 18
19 # TODO: console_scripts for all of these 19 # TODO: console_scripts for all of these
20 20
21 import os 21 import os
22 import shutil 22 import shutil
23 import string
23 import sys 24 import sys
24 from cli import MakeItSoCLI 25 from cli import MakeItSoCLI
25 from makeitso import ContentTemplate 26 from makeitso import ContentTemplate
26 from optparse import OptionParser 27 from optparse import OptionParser
27 from template import MakeItSoTemplate 28 from template import MakeItSoTemplate
95 96
96 # get project from output directory 97 # get project from output directory
97 variables['project'] = self.output2name(output) 98 variables['project'] = self.output2name(output)
98 99
99 # get package name from project 100 # get package name from project
100 # XXX could have looser restrictions with transforms 101 allowable = set(string.letters + string.digits + '_')
101 assert variables['project'].isalnum(), 'Project name must be just letters, you gave %s' % variables['project'] 102 if not set(variables['project']).issubset(allowable):
103 raise AssertionError("Illegal fields in package name")
102 variables['package'] = variables['project'].lower() 104 variables['package'] = variables['project'].lower()
103 105
104 # name of CLI main file 106 # name of CLI main file
105 variables['main'] = 'main' 107 variables['main'] = 'main'
106 108