Changeset 621 for trunk/email2trac.py.in
- Timestamp:
- 06/17/13 21:25:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r620 r621 39 39 -h,--help 40 40 -d, --debug 41 -e, --virtualenv <path> 41 42 -f,--file <configuration file> 42 43 -n,--dry-run … … 47 48 $Id$ 48 49 """ 49 50 ### virualenv51 ##52 # if virtualenv and os.path.exists(virtualenv):53 # activate_this = os.path.join(virtualenv,54 #'bin/activate_this.py')55 # if os.path.exists(activate_this):56 # execfile(activate_this,57 58 50 import os 59 51 import sys … … 76 68 from datetime import timedelta, datetime 77 69 from stat import * 78 79 try:80 from trac import __version__ as trac_version81 from trac import config as trac_config82 83 except ImportError, detail:84 print "Can not find a a valid trac installation, try setting PYTHONPATH"85 sys.exit(1)86 70 87 71 ## Some global variables … … 1793 1777 self.logger.info('subject: %s' %repr(subject)) 1794 1778 1779 ## Ticket id is in Delivered-To Field. Trac notify must send this 1780 # 1781 #try: 1782 # print self.parameters.project_name 1783 # print 'Delivered To', m['Delivered-To'] 1784 # print self.parameters.to_parse_address_delimiter 1785 # id = m['Delivered-To'].split(self.parameters.to_parse_address_delimiter)[1] 1786 # print id 1787 # id = id.split('@')[0] 1788 # print id 1789 # 1790 # except KeyError, detail: 1791 # pass 1792 1793 1795 1794 ## [hic] #1529: Re: LRZ 1796 1795 # [hic] #1529?owner=bas,priority=medium: Re: LRZ … … 2603 2602 verbose = None 2604 2603 debug_interactive = None 2605 2606 SHORT_OPT = 'cdhf:np:t:v' 2607 LONG_OPT = ['component=', 'debug', 'dry-run', 'help', 'file=', 'project=', 'ticket_prefix=', 'verbose'] 2604 virtualenv = '@virtualenv@' 2605 2606 SHORT_OPT = 'cde:hf:np:t:v' 2607 LONG_OPT = ['component=', 'debug', 'dry-run', 'help', 'file=', 'project=', 'ticket_prefix=', 'virtualenv=', 'verbose'] 2608 2608 2609 2609 try: … … 2623 2623 elif opt in ['-d', '--debug']: 2624 2624 debug_interactive = 1 2625 elif opt in ['-e', '--virtualenv']: 2626 virtualenv = value 2625 2627 elif opt in ['-f', '--file']: 2626 2628 configfile = value … … 2633 2635 elif opt in ['-v', '--verbose']: 2634 2636 verbose = True 2637 2638 if virtualenv and os.path.exists(virtualenv): 2639 activate_this = os.path.join(virtualenv, 'bin/activate_this.py') 2640 if os.path.exists(activate_this): 2641 execfile(activate_this, dict(__file__=activate_this)) 2642 2643 try: 2644 from trac import __version__ as trac_version 2645 from trac import config as trac_config 2646 2647 except ImportError, detail: 2648 print "Can not find a a valid trac installation, solutions could be:" 2649 print "\tset PYTHONPATH" 2650 print "\tuse the --virtualenv <dir> option" 2651 sys.exit(1) 2635 2652 2636 2653 settings = ReadConfig(configfile, project_name) … … 2719 2736 logger.error("trac error: %s" %detail) 2720 2737 sys.exit(0) 2738 except TracError, detail: 2739 logger.error("trac error: %s" %detail) 2740 sys.exit(0) 2721 2741 2722 2742 tktparser = TicketEmailParser(env, settings, logger, float(version))
Note: See TracChangeset
for help on using the changeset viewer.