9678.4.1
by Max Bowsher
[r=barry][ui=none] Update Makefile PYTHON_VERSION variables and most script #! lines to python2.5. |
1 |
#!/usr/bin/python2.5
|
8687.15.22
by Karl Fogel
Add the copyright header block to the remaining .py files. |
2 |
#
|
3 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3691.201.5
by James Henstridge
sourceforge importer driver script |
5 |
|
9641.1.7
by Gary Poster
fix scripts to work |
6 |
# pylint: disable-msg=W0403
|
7 |
import _pythonpath |
|
8 |
||
3691.201.5
by James Henstridge
sourceforge importer driver script |
9 |
import logging |
10 |
import optparse |
|
3691.201.38
by James Henstridge
fixes from spiv's review |
11 |
import sys |
3691.201.5
by James Henstridge
sourceforge importer driver script |
12 |
|
13 |
from zope.component import getUtility |
|
14 |
from canonical.config import config |
|
15 |
from canonical.lp import initZopeless |
|
16 |
from canonical.launchpad.interfaces import IProductSet |
|
17 |
from canonical.launchpad.scripts import ( |
|
18 |
execute_zcml_for_scripts, logger_options, logger) |
|
19 |
from canonical.launchpad.ftests import login |
|
7161.1.10
by Gary Poster
all ftests should be passing now. Only page tests--six of them--to go, as far as I know. |
20 |
from canonical.launchpad.webapp.interaction import Participation |
3691.201.5
by James Henstridge
sourceforge importer driver script |
21 |
|
3691.201.6
by James Henstridge
fixes to get import working with siproxd test data |
22 |
from canonical.launchpad.scripts.sftracker import Tracker, TrackerImporter |
3691.201.5
by James Henstridge
sourceforge importer driver script |
23 |
|
24 |
def main(argv): |
|
25 |
parser = optparse.OptionParser(description="This script imports bugs " |
|
26 |
"from Sourceforge into Launchpad.") |
|
27 |
||
28 |
parser.add_option('--product', metavar='PRODUCT', action='store', |
|
29 |
help='The product to associate bugs with', |
|
30 |
type='string', dest='product', default=None) |
|
31 |
parser.add_option('--dumpfile', metavar='XML', action='store', |
|
32 |
help='The XML tracker data dump', |
|
33 |
type='string', dest='dumpfile', default=None) |
|
34 |
parser.add_option('--dumpdir', metavar='DIR', action='store', |
|
35 |
help='The directory with the dumped tracker data', |
|
36 |
type='string', dest='dumpdir', default=None) |
|
3691.201.6
by James Henstridge
fixes to get import working with siproxd test data |
37 |
parser.add_option('--verify-users', dest='verify_users', |
38 |
help='Should created users have verified emails?', |
|
39 |
action='store_true', default=False) |
|
3691.201.5
by James Henstridge
sourceforge importer driver script |
40 |
|
3691.201.6
by James Henstridge
fixes to get import working with siproxd test data |
41 |
logger_options(parser, logging.INFO) |
3691.201.5
by James Henstridge
sourceforge importer driver script |
42 |
|
43 |
options, args = parser.parse_args(argv[1:]) |
|
44 |
logger(options, 'canonical.launchpad.scripts.sftracker') |
|
45 |
||
46 |
# don't send email
|
|
7178.3.1
by Curtis Hovey
Remove that last of the callsites that mutate the config. |
47 |
send_email_data = """ |
48 |
[zopeless]
|
|
49 |
send_email: False
|
|
50 |
"""
|
|
51 |
config.push('send_email_data', send_email_data) |
|
3691.201.5
by James Henstridge
sourceforge importer driver script |
52 |
|
5821.5.14
by James Henstridge
Run execute_zcml_for_scripts() before initZopeless() in many tests. |
53 |
execute_zcml_for_scripts() |
3691.201.5
by James Henstridge
sourceforge importer driver script |
54 |
ztm = initZopeless() |
7161.1.14
by Gary Poster
change per review by flacoste: add in XXX for bugs, add some comments, and factor out some common code |
55 |
# XXX gary 21-Oct-2008 bug 285808
|
7161.1.10
by Gary Poster
all ftests should be passing now. Only page tests--six of them--to go, as far as I know. |
56 |
# We should reconsider using a ftest helper for production code. For now,
|
57 |
# we explicitly keep the code from using a test request by using a basic
|
|
58 |
# participation.
|
|
59 |
login('bug-importer@launchpad.net', Participation()) |
|
3691.201.5
by James Henstridge
sourceforge importer driver script |
60 |
|
61 |
product = getUtility(IProductSet).getByName(options.product) |
|
62 |
tracker = Tracker(options.dumpfile, options.dumpdir) |
|
3691.201.6
by James Henstridge
fixes to get import working with siproxd test data |
63 |
importer = TrackerImporter(product, options.verify_users) |
3691.201.5
by James Henstridge
sourceforge importer driver script |
64 |
|
65 |
importer.importTracker(ztm, tracker) |
|
7178.3.1
by Curtis Hovey
Remove that last of the callsites that mutate the config. |
66 |
config.pop('send_email_data') |
3691.201.5
by James Henstridge
sourceforge importer driver script |
67 |
|
68 |
if __name__ == '__main__': |
|
69 |
sys.exit(main(sys.argv)) |