Changeset 621


Ignore:
Timestamp:
06/17/13 21:25:11 (11 years ago)
Author:
bas
Message:

added support for trac installations in a virtual environment, eg:

  • configure --virtualenv=/data/virtualenvs/trac
  • set/override it with email2trac --virtualenv=/data/virtualenv/trac_1.2

Updated release version to 2.7

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r620 r621  
    1 2.X.X
     12.7.0
    22  * use self.env.get_read_db for trac version > 0.11. self.env.get_db_cnx is obsolete. TRAC
    33    api documentation.
     
    66  * fixed an UnicodeDecodeError when checking attachments filenames.
    77    Fixed by: Bas van der Vlies
     8
     9  * Added support for installing trac in a virtual enviroment. You can
     10    set a default virtualenv path add configuration time, eg:
     11      - ./configure --with-virtualenv=/data/virtualenvs/trac
     12   
     13    Or set/override at runtime: eg:
     14     - ./email2trac.py --virtualenv=/data/virtualenvs/trac
     15    Author:  Bas van der Vlies & Dennis Stam (Suggestion)
    816
    9172.6.2
  • trunk/configure

    r574 r621  
    579579PYTHON_VERSION
    580580PYTHON
     581virtualenv
    581582install_user
    582583mta_user
     
    627628with_trac_user
    628629with_mta_user
     630with_virtualenv
    629631'
    630632      ac_precious_vars='build_alias
     
    12541256  --with-mta_user=USER    Specify the name of the user that your MTA use,
    12551257                          default=nobody
     1258
     1259  --with-virtualenv=directory    Specify the default virtualenv path to use for trac,
     1260                          default=""
    12561261
    12571262Some influential environment variables:
     
    18941899
    18951900
     1901
    18961902#DEBUG=0
    18971903
     
    32093215else
    32103216  mta_user="nobody"
     3217
     3218fi
     3219
     3220# We can specify a default virtual env path for trac
     3221#
     3222
     3223# Check whether --with-virtualenv was given.
     3224if test "${with_virtualenv+set}" = set; then :
     3225  withval=$with_virtualenv; case "${withval}" in
     3226        *) virtualenv="${withval}" ;;
     3227  esac
     3228else
     3229  virtualenv=""
    32113230
    32123231fi
  • trunk/configure.in

    r574 r621  
    1515AC_SUBST(install_user)
    1616AC_SUBST(sysconfdir)
     17AC_SUBST(virtualenv)
    1718
    1819#DEBUG=0
     
    6970)dnl           
    7071
     72# We can specify a default virtual env path for trac
     73#
     74AC_ARG_WITH(virtualenv,
     75[
     76  --with-virtualenv=directory    Specify the default virtualenv path to use for trac,
     77                          default=""],
     78
     79  [case "${withval}" in
     80        *) virtualenv="${withval}" ;;
     81  esac],
     82
     83  [virtualenv=""]
     84)dnl           
     85
    7186dnl ##### Path to email2trac.conf
    7287dnl This ugly kludge to get the sysconfdir path is needed because
  • trunk/debian/changelog

    r619 r621  
     1email2trac (2.7.0-1) stable; urgency=low
     2
     3  * See Changelog
     4
     5 -- Bas van der Vlies <bas.vandervlies@surfsara.nl>  Mon, 17 Jun 2013 21:16:32 +0200
     6
    17email2trac (2.6.3-1) stable; urgency=low
    28
  • trunk/email2trac.py.in

    r620 r621  
    3939                -h,--help
    4040                -d, --debug
     41                -e, --virtualenv <path>
    4142                -f,--file  <configuration file>
    4243                -n,--dry-run
     
    4748        $Id$
    4849"""
    49 
    50 ### virualenv
    51 ##
    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 
    5850import os
    5951import sys
     
    7668from datetime import timedelta, datetime
    7769from stat import *
    78 
    79 try:
    80     from trac import __version__ as trac_version
    81     from trac import config as trac_config
    82 
    83 except ImportError, detail:
    84     print "Can not find a a valid trac installation, try setting PYTHONPATH"
    85     sys.exit(1)
    8670
    8771## Some global variables
     
    17931777        self.logger.info('subject: %s' %repr(subject))
    17941778
     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
    17951794        ## [hic] #1529: Re: LRZ
    17961795        #  [hic] #1529?owner=bas,priority=medium: Re: LRZ
     
    26032602    verbose = None
    26042603    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']
    26082608
    26092609    try:
     
    26232623        elif opt in ['-d', '--debug']:
    26242624            debug_interactive = 1
     2625        elif opt in ['-e', '--virtualenv']:
     2626            virtualenv = value
    26252627        elif opt in ['-f', '--file']:
    26262628            configfile = value
     
    26332635        elif opt in ['-v', '--verbose']:
    26342636            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)
    26352652   
    26362653    settings = ReadConfig(configfile, project_name)
     
    27192736            logger.error("trac error: %s" %detail)
    27202737            sys.exit(0)
     2738        except TracError, detail:
     2739            logger.error("trac error: %s" %detail)
     2740            sys.exit(0)
    27212741
    27222742        tktparser = TicketEmailParser(env, settings, logger, float(version))
  • trunk/email2trac.spec

    r616 r621  
    11Summary: Utilities for converting emails to trac tickets
    22Name: email2trac
    3 Version: 2.6.2
     3Version: 2.7.0
    44Release: 1
    55License: Apache License 2.0
Note: See TracChangeset for help on using the changeset viewer.