comparison makeitso/python.py @ 162:1a419ebe0fe5

sdad
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 30 Jul 2013 15:43:43 -0700
parents a5d058957734
children 197e7b523a07
comparison
equal deleted inserted replaced
161:a5d058957734 162:1a419ebe0fe5
34 ] 34 ]
35 35
36 def output2name(self, path): 36 def output2name(self, path):
37 return os.path.splitext(os.path.basename(path.rstrip(os.path.sep)))[0] 37 return os.path.splitext(os.path.basename(path.rstrip(os.path.sep)))[0]
38 38
39
39 class PythonScriptTemplate(PythonTemplate): 40 class PythonScriptTemplate(PythonTemplate):
40 """template for a single python script""" 41 """template for a single python script"""
41 templates = [('python_package', '{{package}}', '{{main}}.py')] 42 templates = [('python_package', '{{package}}', '{{main}}.py')]
42 vars = [Variable('description')] 43 vars = [Variable('description')]
44
43 45
44 class PythonModuleTemplate(PythonTemplate): 46 class PythonModuleTemplate(PythonTemplate):
45 """single module python package""" 47 """single module python package"""
46 # TODO: this should use the same files as PythonPackageTemplate 48 # TODO: this should use the same files as PythonPackageTemplate
47 templates = ['python_module', 49 templates = ['python_module',
48 ('python_package', '{{package}}', '{{main}}.py')] 50 ('python_package', '{{package}}', '{{main}}.py')]
49 vars = [Variable('description')] 51 vars = [Variable('description')]
50 look = False 52 look = False
51 53
52 def pre(self, variables, output): 54 def pre(self, variables, output):
53 variables['module'] = variables['main'] = self.output2name(output) 55 variables['project'] = variables['module'] = variables['main'] = self.output2name(output)
56
54 57
55 class PythonPackageTemplate(PythonTemplate): 58 class PythonPackageTemplate(PythonTemplate):
56 """ 59 """
57 python package template 60 python package template
58 """ 61 """