Merge lp:~francesco-marella/specto/fix-sdist into lp:specto

Proposed by Francesco Marella
Status: Merged
Merged at revision: 174
Proposed branch: lp:~francesco-marella/specto/fix-sdist
Merge into: lp:specto
Diff against target: 326 lines (+117/-125)
7 files modified
VERSION (+0/-1)
setup.py (+102/-101)
spectlib/__init__.py (+3/-0)
spectlib/constants.py.in (+0/-7)
spectlib/i18n.py (+6/-6)
spectlib/main.py (+1/-6)
spectlib/util.py (+5/-4)
To merge this branch: bzr merge lp:~francesco-marella/specto/fix-sdist
Reviewer Review Type Date Requested Status
Jeff Fortin Tam Needs Fixing
Review via email: mp+71010@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

After uncompressing the tarball resulting from "python setup.py sdist", "sudo setup.py install" fails like so:

  running install_scripts
  copying build/scripts-2.7/specto -> /usr/bin
  changing mode of /usr/bin/specto to 755
  running install_data
  error: can't copy 'specto.desktop': doesn't exist or not a regular file

Then when you try to run "sudo python setup.py uninstall", you get:

  warning: uninstall: Could not read installed files list installed_files

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'VERSION'
2--- VERSION 2011-06-23 18:55:56 +0000
3+++ VERSION 1970-01-01 00:00:00 +0000
4@@ -1,1 +0,0 @@
5-0.4
6
7=== added directory 'data/desktop'
8=== renamed file 'specto.desktop.in' => 'data/desktop/specto.desktop.in'
9=== modified file 'setup.py'
10--- setup.py 2011-01-07 12:40:33 +0000
11+++ setup.py 2011-08-10 10:01:36 +0000
12@@ -12,6 +12,17 @@
13
14 INSTALLED_FILES = "installed_files"
15
16+from spectlib import __pkg_version__ as version
17+
18+def give_files(dir, *extension):
19+ files=[]
20+ all_files=os.listdir(dir)
21+ for file in all_files:
22+ ext=(os.path.splitext(file))[1]
23+ if ext in extension:
24+ files.append(dir + file)
25+ return files
26+
27 class install (_install):
28
29 def run (self):
30@@ -78,60 +89,46 @@
31 print "Please specify operation : %s" % " | ".join (ops)
32 raise SystemExit
33
34-prefix = None
35-if len (sys.argv) > 2:
36- i = 0
37- for o in sys.argv:
38- if o.startswith ("--prefix"):
39- if o == "--prefix":
40- if len (sys.argv) >= i:
41- prefix = sys.argv[i + 1]
42- sys.argv.remove (prefix)
43- elif o.startswith ("--prefix=") and len (o[9:]):
44- prefix = o[9:]
45- sys.argv.remove (o)
46- break
47- i += 1
48-if not prefix and "PREFIX" in os.environ:
49- prefix = os.environ["PREFIX"]
50-if not prefix or not len (prefix):
51- prefix = "/usr/local"
52-
53-if sys.argv[1] in ("install", "uninstall") and len (prefix):
54- sys.argv += ["--prefix", prefix]
55-
56-with open("VERSION", "r") as version_file:
57- version = version_file.read().strip()
58-
59-with open(os.path.join ("spectlib/constants.py.in"), "rt") as file_in:
60- data = file_in.read ()
61- data = data.replace ("@prefix@", prefix)
62- data = data.replace ("@version@", version)
63- with open (os.path.join ("spectlib/constants.py"), "wt") as file_out:
64- file_out.write (data)
65-
66-with open(os.path.join("data/indicator/specto.in"), "rt") as file_in:
67- data = file_in.read()
68- data = data.replace("@prefix@", prefix)
69- with open (os.path.join ("data/indicator/specto"), "wt") as file_out:
70- file_out.write(data)
71-
72-cmd = "intltool-merge -d -u po/ specto.desktop.in specto.desktop".split(" ")
73-try:
74- proc = subprocess.Popen(cmd)
75- proc.wait()
76-except:
77- print "Error: intltool-merge not found, please install the intltool package."
78- raise SystemExit
79-
80-def give_files(dir, *extension):
81- files=[]
82- all_files=os.listdir(dir)
83- for file in all_files:
84- ext=(os.path.splitext(file))[1]
85- if ext in extension:
86- files.append(dir + file)
87- return files
88+
89+if sys.argv[1] in ("build", "install"):
90+ prefix = None
91+ if len (sys.argv) > 2:
92+ i = 0
93+ for o in sys.argv:
94+ if o.startswith ("--prefix"):
95+ if o == "--prefix":
96+ if len (sys.argv) >= i:
97+ prefix = sys.argv[i + 1]
98+ sys.argv.remove (prefix)
99+ elif o.startswith ("--prefix=") and len (o[9:]):
100+ prefix = o[9:]
101+ sys.argv.remove (o)
102+ break
103+ i += 1
104+ if not prefix and "PREFIX" in os.environ:
105+ prefix = os.environ["PREFIX"]
106+ if not prefix or not len (prefix):
107+ prefix = sys.prefix
108+ if not prefix or not len (prefix):
109+ prefix = "/usr/local"
110+
111+ if sys.argv[1] in ("install", "uninstall") and len (prefix):
112+ sys.argv += ["--prefix", prefix]
113+
114+ if sys.argv[1] == "build":
115+ with open(os.path.join("data/indicator/specto.in"), "rt") as file_in:
116+ data = file_in.read()
117+ data = data.replace("@prefix@", prefix)
118+ with open (os.path.join ("data/indicator/specto"), "wt") as file_out:
119+ file_out.write(data)
120+
121+ cmd = "intltool-merge -d -u po/ data/desktop/specto.desktop.in specto.desktop".split(" ")
122+ try:
123+ proc = subprocess.Popen(cmd)
124+ proc.wait()
125+ except:
126+ print "Error: intltool-merge not found, please install the intltool package."
127+ raise SystemExit
128
129 custom_images = []
130
131@@ -145,47 +142,55 @@
132 global_icon_path = "share/icons/hicolor"
133 local_icon_path = "share/specto/icons/hicolor/"
134
135-for dir, subdirs, files in os.walk("data/icons/"):
136- if dir == "data/icons/":
137- for file in files:
138- custom_images.append(dir + file)
139- else:
140- images = []
141- global_images = []
142-
143- for file in files:
144- if file.find(".svg") or file.find(".png"):
145- file_path = "%s/%s" % (dir, file)
146- # global image
147- if file[:-4] == "specto":
148- global_images.append(file_path)
149- # local image
150- else:
151- images.append(file_path)
152- # local
153- if len(images) > 0:
154- data_files.append((local_icon_path + dir[10:], images))
155- # global
156- if len(global_images) > 0:
157- data_files.append((global_icon_path + dir[10:], global_images))
158-
159-data_files.append(("share/specto/icons/", custom_images))
160-
161-podir = os.path.join (os.path.realpath ("."), "po")
162-if os.path.isdir (podir):
163- buildcmd = "msgfmt -o build/locale/%s/specto.mo po/%s.po"
164- mopath = "build/locale/%s/specto.mo"
165- destpath = "share/locale/%s/LC_MESSAGES"
166- for name in os.listdir (podir):
167- if name[-2:] == "po":
168- name = name[:-3]
169- if sys.argv[1] == "build" \
170- or (sys.argv[1] == "install" and \
171- not os.path.exists (mopath % name)):
172- if not os.path.isdir ("build/locale/" + name):
173- os.makedirs ("build/locale/" + name)
174- os.system (buildcmd % (name, name))
175- data_files.append ((destpath % name, [mopath % name]))
176+if sys.argv[1] in ("build", "install"):
177+ for dir, subdirs, files in os.walk("data/icons/"):
178+ if dir == "data/icons/":
179+ for file in files:
180+ custom_images.append(dir + file)
181+ else:
182+ images = []
183+ global_images = []
184+
185+ for file in files:
186+ if file.find(".svg") or file.find(".png"):
187+ file_path = "%s/%s" % (dir, file)
188+ # global image
189+ if file[:-4] == "specto":
190+ global_images.append(file_path)
191+ # local image
192+ else:
193+ images.append(file_path)
194+ # local
195+ if len(images) > 0:
196+ data_files.append((local_icon_path + dir[10:], images))
197+ # global
198+ if len(global_images) > 0:
199+ data_files.append((global_icon_path + dir[10:], global_images))
200+
201+ data_files.append(("share/specto/icons/", custom_images))
202+
203+ podir = os.path.join (os.path.realpath ("."), "po")
204+ if os.path.isdir (podir):
205+ buildcmd = "msgfmt -o build/locale/%s/specto.mo po/%s.po"
206+ mopath = "build/locale/%s/specto.mo"
207+ destpath = "share/locale/%s/LC_MESSAGES"
208+ for name in os.listdir (podir):
209+ if name[-2:] == "po":
210+ name = name[:-3]
211+ if sys.argv[1] == "build" \
212+ or (sys.argv[1] == "install" and \
213+ not os.path.exists (mopath % name)):
214+ if not os.path.isdir ("build/locale/" + name):
215+ os.makedirs ("build/locale/" + name)
216+ os.system (buildcmd % (name, name))
217+ data_files.append ((destpath % name, [mopath % name]))
218+
219+if sys.argv[1] == "clean":
220+ try:
221+ os.remove ("data/indicator/specto")
222+ os.remove ("specto.desktop")
223+ except:
224+ pass
225
226
227 setup(name = "specto",
228@@ -202,13 +207,9 @@
229 "install_data" : install_data}
230 )
231
232-os.remove ("spectlib/constants.py")
233-os.remove ("data/indicator/specto")
234-os.remove ("specto.desktop")
235-
236 if sys.argv[1] == "install":
237- gtk_update_icon_cache = '''gtk-update-icon-cache -f -t \
238-%s/share/icons/hicolor''' % prefix
239+ gtk_update_icon_cache = "gtk-update-icon-cache -f -t \
240+%s/share/icons/hicolor" % prefix
241 root_specified = len (filter (lambda s: s.startswith ("--root"),
242 sys.argv)) > 0
243 if not root_specified:
244
245=== modified file 'spectlib/__init__.py'
246--- spectlib/__init__.py 2006-12-17 03:53:01 +0000
247+++ spectlib/__init__.py 2011-08-10 10:01:36 +0000
248@@ -0,0 +1,3 @@
249+
250+__pkg_name__ = 'specto'
251+__pkg_version__ = '0.4.1'
252
253=== removed file 'spectlib/constants.py.in'
254--- spectlib/constants.py.in 2010-11-23 14:32:32 +0000
255+++ spectlib/constants.py.in 1970-01-01 00:00:00 +0000
256@@ -1,7 +0,0 @@
257-# -*- coding: utf-8 -*-
258-
259-# The Specto version
260-VERSION = "@version@"
261-
262-# The prefix were Specto is installed to.
263-PREFIX = "@prefix@"
264
265=== modified file 'spectlib/i18n.py'
266--- spectlib/i18n.py 2010-11-23 15:28:11 +0000
267+++ spectlib/i18n.py 2011-08-10 10:01:36 +0000
268@@ -25,13 +25,13 @@
269 import gettext
270 import locale
271
272-# If Specto is installed read prefix from constants module
273+
274 MESSAGES_DIR = ''
275-try:
276- from spectlib.constants import PREFIX
277- MESSAGES_DIR = "%s/share/locale" % PREFIX
278-except ImportError:
279- pass
280+if os.path.exists("/usr/share/locale") and os.path.isdir("/usr/share/locale"):
281+ MESSAGES_DIR = "/usr/share/locale"
282+elif os.path.exists("/usr/local/share/locale") and \
283+ os.path.isdir("/usr/local/share/locale"):
284+ MESSAGES_DIR = "/usr/local/share/locale"
285
286 def setup_locale_and_gettext():
287 package_name = 'specto'
288
289=== modified file 'spectlib/main.py'
290--- spectlib/main.py 2011-06-23 15:23:11 +0000
291+++ spectlib/main.py 2011-08-10 10:01:36 +0000
292@@ -45,12 +45,7 @@
293 from spectlib.tools import networkmanager as conmgr
294
295
296-VERSION = "undefined"
297-try:
298- from spectlib.constants import VERSION
299-except ImportError:
300- with open("VERSION", 'r') as version_file:
301- VERSION = version_file.read().strip()
302+from spectlib import __pkg_version__ as VERSION
303
304 #create a gconf object
305 specto_gconf = Specto_gconf("/apps/specto")
306
307=== modified file 'spectlib/util.py'
308--- spectlib/util.py 2010-11-23 16:19:28 +0000
309+++ spectlib/util.py 2011-08-10 10:01:36 +0000
310@@ -26,11 +26,12 @@
311
312 from spectlib.tools.specto_gconf import Specto_gconf
313
314+
315 PREFIX = ''
316-try:
317- from spectlib.constants import PREFIX
318-except ImportError:
319- pass
320+if os.path.exists("/usr") and os.path.isdir("/usr"):
321+ PREFIX = "/usr"
322+elif os.path.exists("/usr/local") and os.path.isdir("/usr/local"):
323+ PREFIX = "/usr/local"
324
325 def return_webpage(webpage):
326 """ Open the webpage in the default browser. """

Subscribers

People subscribed via source and target branches