Merge lp:~stub/launchpad/trivial into lp:launchpad

Proposed by Stuart Bishop
Status: Merged
Merged at revision: not available
Proposed branch: lp:~stub/launchpad/trivial
Merge into: lp:launchpad
Diff against target: 166 lines
To merge this branch: bzr merge lp:~stub/launchpad/trivial
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Review via email: mp+7634@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Make some antique scripts do 'import _pythonpath' so the buildout configured path is used.

Also update the copyright strings and fix lint issues in these files.

Revision history for this message
Paul Hummer (rockstar) :
review: Approve
lp:~stub/launchpad/trivial updated
8682. By Launchpad PQM Bot

[r=rockstar][ui=none][bug=389065] All scripts need to import _pythonpath to function correctly with buildout

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/diagram.py'
2--- database/schema/diagram.py 2007-05-03 12:40:20 +0000
3+++ database/schema/diagram.py 2009-06-18 16:40:24 +0000
4@@ -1,11 +1,13 @@
5 #!/usr/bin/python2.4
6-# Copyright 2004-2005 Canonical Ltd. All rights reserved.
7+# Copyright 2004-2009 Canonical Ltd. All rights reserved.
8
9 __metaclass__ = type
10
11+# pylint: disable-msg=W0403
12+import _pythonpath
13+
14 import psycopg, sys, os, re
15 from sets import Set
16-from fti import quote_identifier
17 from security import DbSchema, CursorWrapper
18 from ConfigParser import SafeConfigParser, NoOptionError
19
20@@ -95,7 +97,7 @@
21
22 for i in xrange(0, len(lines)):
23 line = lines[i]
24-
25+
26 # Trim tables we don't want to see
27 m = re.search(r'^\s* "(.+?)" \s+ \[shape', line, re.X)
28 if m is not None:
29@@ -124,17 +126,17 @@
30 if t1 not in wanted_tables:
31 lines[i] = ''
32 continue
33-
34+
35 # Links to ourself are fine, unless the table is not wanted
36 if t1 == t2:
37 continue
38-
39+
40 # Get allowed links
41 allowed_link = True
42 if t2 not in wanted_tables:
43 allowed_link = False
44 else:
45- for source, end in [ (t1,t2), (t2,t1) ]:
46+ for source, end in [(t1, t2), (t2, t1)]:
47 try:
48 allowed = config.get(section, source)
49 except NoOptionError:
50@@ -180,7 +182,7 @@
51 rv.append(dst)
52 return rv
53
54-
55+
56 def main(filetypes):
57
58 print filetypes
59@@ -249,6 +251,3 @@
60
61 main(ft)
62
63-# List all foreign key constraints
64-# select pg_namespace.nspname as ns,src.relname as src,dst.relname as dst from pg_constraint,pg_namespace,pg_class as src,pg_class as dst where pg_namespace.oid = connamespace and src.oid = conrelid and dst.oid = confrelid;
65-
66
67=== modified file 'database/schema/online_fti_updater.py'
68--- database/schema/online_fti_updater.py 2007-03-20 03:24:02 +0000
69+++ database/schema/online_fti_updater.py 2009-06-18 16:40:24 +0000
70@@ -1,12 +1,15 @@
71 #!/usr/bin/python2.4
72-# Copyright 2006 Canonical Ltd. All rights reserved.
73+# Copyright 2006-2009 Canonical Ltd. All rights reserved.
74 """
75 Rebuild the full text indexes in a more friendly fashion, enabling this to
76 be done without downtime.
77 """
78 __metaclass__ = type
79
80-from fti import ALL_FTI, quote_identifier
81+# pylint: disable-msg=W0403
82+import _pythonpath
83+
84+from fti import ALL_FTI
85 import psycopg
86
87 def main():
88
89=== modified file 'database/schema/reset_sequences.py'
90--- database/schema/reset_sequences.py 2007-03-20 03:24:02 +0000
91+++ database/schema/reset_sequences.py 2009-06-18 16:40:24 +0000
92@@ -1,5 +1,5 @@
93 #!/usr/bin/python2.4
94-# Copyright 2004-2005 Canonical Ltd. All rights reserved.
95+# Copyright 2004-2009 Canonical Ltd. All rights reserved.
96 """
97 The sampledata does not update the current values of all the sequences
98 used to populate the primary keys (this was removed to aid in merging changes
99@@ -11,10 +11,8 @@
100
101 __metaclass__ = type
102
103-import sys, os, os.path
104-sys.path.insert(
105- 0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'lib')
106- )
107+# pylint: disable-msg=W0403
108+import _pythonpath
109
110 from optparse import OptionParser
111 from canonical.database.postgresql import resetSequences
112
113=== modified file 'database/schema/security.py'
114--- database/schema/security.py 2009-04-17 10:32:16 +0000
115+++ database/schema/security.py 2009-06-18 16:40:24 +0000
116@@ -1,5 +1,5 @@
117 #!/usr/bin/python2.4
118-# Copyright 2004-2005 Canonical Ltd. All rights reserved.
119+# Copyright 2004-2009 Canonical Ltd. All rights reserved.
120
121 __metaclass__ = type
122
123
124=== modified file 'database/schema/sort_sql.py'
125--- database/schema/sort_sql.py 2007-03-20 03:24:02 +0000
126+++ database/schema/sort_sql.py 2009-06-18 16:40:24 +0000
127@@ -1,5 +1,5 @@
128 #!/usr/bin/python2.4
129-# Copyright 2005 Canonical Ltd. All rights reserved.
130+# Copyright 2005-2009 Canonical Ltd. All rights reserved.
131
132 """Script to sort SQL dumps.
133
134@@ -24,9 +24,10 @@
135
136 __metaclass__ = type
137
138-import sys, os, os.path
139-sys.path.insert(0, os.path.join(
140- os.path.dirname(__file__), os.pardir, os.pardir, 'lib'))
141+# pylint: disable-msg=W0403
142+import _pythonpath
143+
144+import sys
145
146 from canonical.launchpad.scripts.sort_sql import Parser, print_lines_sorted
147
148
149=== modified file 'database/schema/upgrade.py'
150--- database/schema/upgrade.py 2009-04-17 10:32:16 +0000
151+++ database/schema/upgrade.py 2009-06-18 16:40:24 +0000
152@@ -1,12 +1,12 @@
153 #!/usr/bin/python2.4
154-# Copyright 2004-2008 Canonical Ltd. All rights reserved.
155-# pylint: disable-msg=W0403
156+# Copyright 2004-2009 Canonical Ltd. All rights reserved.
157 """
158 Apply all outstanding schema patches to an existing launchpad database
159 """
160
161 __metaclass__ = type
162
163+# pylint: disable-msg=W0403
164 import _pythonpath # Sort PYTHONPATH
165
166 from cStringIO import StringIO