source: createpluginscript/anyrelease/create_trac_plugin/create_plugin.py

Last change on this file was 3945, checked in by Jeff Hammel, 15 years ago

initial import of the script

File size: 1.2 KB
Line 
1#!/usr/bin/env python
2
3"""
4script to create a trac plugin given the interfaces to be used
5"""
6
7import os
8import subprocess
9import sys
10
11from create_trac_plugin.create_component import check_interfaces
12from create_trac_plugin.create_component import parse_args
13from create_trac_plugin.create_component import print_component
14
15def main():
16
17    ### parse the arguments
18    parse_args()
19
20    ### check to ensure that the interfaces given actually exist
21    nonexistant = check_interfaces(*sys.argv[2:])
22    if nonexistant:
23        print "Error: interfaces specified not found: " + ', '.join(nonexistant)
24        sys.exit(1)
25
26    ### run paster create -t trac_plugin
27    ### this should be installed as a dependency
28    # XXX this should probably use python code instead of shelling out
29    subprocess.call(['paster', 'create', '-t', 'trac_plugin', sys.argv[1]])
30
31    # figure out what paster did
32    project = sys.argv[1].lower()
33    filename = os.path.join(sys.argv[1], project, '%s.py' % project)
34
35    ### (re)generate the plugin file based on the interfaces passed
36    component = print_component(*sys.argv[1:])
37    module = file(filename, 'w')
38    print >> module, component
39    module.close()
40               
41if __name__ == '__main__':
42    main()
43                         
Note: See TracBrowser for help on using the repository browser.