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
=== removed file 'VERSION'
--- VERSION 2011-06-23 18:55:56 +0000
+++ VERSION 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
10.4
20
=== added directory 'data/desktop'
=== renamed file 'specto.desktop.in' => 'data/desktop/specto.desktop.in'
=== modified file 'setup.py'
--- setup.py 2011-01-07 12:40:33 +0000
+++ setup.py 2011-08-10 10:01:36 +0000
@@ -12,6 +12,17 @@
1212
13INSTALLED_FILES = "installed_files"13INSTALLED_FILES = "installed_files"
1414
15from spectlib import __pkg_version__ as version
16
17def give_files(dir, *extension):
18 files=[]
19 all_files=os.listdir(dir)
20 for file in all_files:
21 ext=(os.path.splitext(file))[1]
22 if ext in extension:
23 files.append(dir + file)
24 return files
25
15class install (_install):26class install (_install):
1627
17 def run (self):28 def run (self):
@@ -78,60 +89,46 @@
78 print "Please specify operation : %s" % " | ".join (ops)89 print "Please specify operation : %s" % " | ".join (ops)
79 raise SystemExit90 raise SystemExit
8091
81prefix = None92
82if len (sys.argv) > 2:93if sys.argv[1] in ("build", "install"):
83 i = 094 prefix = None
84 for o in sys.argv:95 if len (sys.argv) > 2:
85 if o.startswith ("--prefix"):96 i = 0
86 if o == "--prefix":97 for o in sys.argv:
87 if len (sys.argv) >= i:98 if o.startswith ("--prefix"):
88 prefix = sys.argv[i + 1]99 if o == "--prefix":
89 sys.argv.remove (prefix)100 if len (sys.argv) >= i:
90 elif o.startswith ("--prefix=") and len (o[9:]):101 prefix = sys.argv[i + 1]
91 prefix = o[9:]102 sys.argv.remove (prefix)
92 sys.argv.remove (o)103 elif o.startswith ("--prefix=") and len (o[9:]):
93 break104 prefix = o[9:]
94 i += 1105 sys.argv.remove (o)
95if not prefix and "PREFIX" in os.environ:106 break
96 prefix = os.environ["PREFIX"]107 i += 1
97if not prefix or not len (prefix):108 if not prefix and "PREFIX" in os.environ:
98 prefix = "/usr/local"109 prefix = os.environ["PREFIX"]
99110 if not prefix or not len (prefix):
100if sys.argv[1] in ("install", "uninstall") and len (prefix):111 prefix = sys.prefix
101 sys.argv += ["--prefix", prefix]112 if not prefix or not len (prefix):
102113 prefix = "/usr/local"
103with open("VERSION", "r") as version_file:114
104 version = version_file.read().strip()115 if sys.argv[1] in ("install", "uninstall") and len (prefix):
105116 sys.argv += ["--prefix", prefix]
106with open(os.path.join ("spectlib/constants.py.in"), "rt") as file_in:117
107 data = file_in.read ()118 if sys.argv[1] == "build":
108 data = data.replace ("@prefix@", prefix)119 with open(os.path.join("data/indicator/specto.in"), "rt") as file_in:
109 data = data.replace ("@version@", version)120 data = file_in.read()
110 with open (os.path.join ("spectlib/constants.py"), "wt") as file_out:121 data = data.replace("@prefix@", prefix)
111 file_out.write (data)122 with open (os.path.join ("data/indicator/specto"), "wt") as file_out:
112123 file_out.write(data)
113with open(os.path.join("data/indicator/specto.in"), "rt") as file_in:124
114 data = file_in.read()125 cmd = "intltool-merge -d -u po/ data/desktop/specto.desktop.in specto.desktop".split(" ")
115 data = data.replace("@prefix@", prefix)126 try:
116 with open (os.path.join ("data/indicator/specto"), "wt") as file_out:127 proc = subprocess.Popen(cmd)
117 file_out.write(data)128 proc.wait()
118129 except:
119cmd = "intltool-merge -d -u po/ specto.desktop.in specto.desktop".split(" ")130 print "Error: intltool-merge not found, please install the intltool package."
120try:131 raise SystemExit
121 proc = subprocess.Popen(cmd)
122 proc.wait()
123except:
124 print "Error: intltool-merge not found, please install the intltool package."
125 raise SystemExit
126
127def give_files(dir, *extension):
128 files=[]
129 all_files=os.listdir(dir)
130 for file in all_files:
131 ext=(os.path.splitext(file))[1]
132 if ext in extension:
133 files.append(dir + file)
134 return files
135132
136custom_images = []133custom_images = []
137134
@@ -145,47 +142,55 @@
145global_icon_path = "share/icons/hicolor"142global_icon_path = "share/icons/hicolor"
146local_icon_path = "share/specto/icons/hicolor/"143local_icon_path = "share/specto/icons/hicolor/"
147144
148for dir, subdirs, files in os.walk("data/icons/"):145if sys.argv[1] in ("build", "install"):
149 if dir == "data/icons/":146 for dir, subdirs, files in os.walk("data/icons/"):
150 for file in files:147 if dir == "data/icons/":
151 custom_images.append(dir + file)148 for file in files:
152 else:149 custom_images.append(dir + file)
153 images = []150 else:
154 global_images = []151 images = []
155152 global_images = []
156 for file in files:153
157 if file.find(".svg") or file.find(".png"):154 for file in files:
158 file_path = "%s/%s" % (dir, file)155 if file.find(".svg") or file.find(".png"):
159 # global image156 file_path = "%s/%s" % (dir, file)
160 if file[:-4] == "specto":157 # global image
161 global_images.append(file_path)158 if file[:-4] == "specto":
162 # local image159 global_images.append(file_path)
163 else:160 # local image
164 images.append(file_path)161 else:
165 # local162 images.append(file_path)
166 if len(images) > 0:163 # local
167 data_files.append((local_icon_path + dir[10:], images))164 if len(images) > 0:
168 # global165 data_files.append((local_icon_path + dir[10:], images))
169 if len(global_images) > 0:166 # global
170 data_files.append((global_icon_path + dir[10:], global_images))167 if len(global_images) > 0:
171168 data_files.append((global_icon_path + dir[10:], global_images))
172data_files.append(("share/specto/icons/", custom_images))169
173170 data_files.append(("share/specto/icons/", custom_images))
174podir = os.path.join (os.path.realpath ("."), "po")171
175if os.path.isdir (podir):172 podir = os.path.join (os.path.realpath ("."), "po")
176 buildcmd = "msgfmt -o build/locale/%s/specto.mo po/%s.po"173 if os.path.isdir (podir):
177 mopath = "build/locale/%s/specto.mo"174 buildcmd = "msgfmt -o build/locale/%s/specto.mo po/%s.po"
178 destpath = "share/locale/%s/LC_MESSAGES"175 mopath = "build/locale/%s/specto.mo"
179 for name in os.listdir (podir):176 destpath = "share/locale/%s/LC_MESSAGES"
180 if name[-2:] == "po":177 for name in os.listdir (podir):
181 name = name[:-3]178 if name[-2:] == "po":
182 if sys.argv[1] == "build" \179 name = name[:-3]
183 or (sys.argv[1] == "install" and \180 if sys.argv[1] == "build" \
184 not os.path.exists (mopath % name)):181 or (sys.argv[1] == "install" and \
185 if not os.path.isdir ("build/locale/" + name):182 not os.path.exists (mopath % name)):
186 os.makedirs ("build/locale/" + name)183 if not os.path.isdir ("build/locale/" + name):
187 os.system (buildcmd % (name, name))184 os.makedirs ("build/locale/" + name)
188 data_files.append ((destpath % name, [mopath % name]))185 os.system (buildcmd % (name, name))
186 data_files.append ((destpath % name, [mopath % name]))
187
188if sys.argv[1] == "clean":
189 try:
190 os.remove ("data/indicator/specto")
191 os.remove ("specto.desktop")
192 except:
193 pass
189194
190195
191setup(name = "specto",196setup(name = "specto",
@@ -202,13 +207,9 @@
202 "install_data" : install_data}207 "install_data" : install_data}
203 )208 )
204209
205os.remove ("spectlib/constants.py")
206os.remove ("data/indicator/specto")
207os.remove ("specto.desktop")
208
209if sys.argv[1] == "install":210if sys.argv[1] == "install":
210 gtk_update_icon_cache = '''gtk-update-icon-cache -f -t \211 gtk_update_icon_cache = "gtk-update-icon-cache -f -t \
211%s/share/icons/hicolor''' % prefix212%s/share/icons/hicolor" % prefix
212 root_specified = len (filter (lambda s: s.startswith ("--root"),213 root_specified = len (filter (lambda s: s.startswith ("--root"),
213 sys.argv)) > 0214 sys.argv)) > 0
214 if not root_specified:215 if not root_specified:
215216
=== modified file 'spectlib/__init__.py'
--- spectlib/__init__.py 2006-12-17 03:53:01 +0000
+++ spectlib/__init__.py 2011-08-10 10:01:36 +0000
@@ -0,0 +1,3 @@
1
2__pkg_name__ = 'specto'
3__pkg_version__ = '0.4.1'
04
=== removed file 'spectlib/constants.py.in'
--- spectlib/constants.py.in 2010-11-23 14:32:32 +0000
+++ spectlib/constants.py.in 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1# -*- coding: utf-8 -*-
2
3# The Specto version
4VERSION = "@version@"
5
6# The prefix were Specto is installed to.
7PREFIX = "@prefix@"
80
=== modified file 'spectlib/i18n.py'
--- spectlib/i18n.py 2010-11-23 15:28:11 +0000
+++ spectlib/i18n.py 2011-08-10 10:01:36 +0000
@@ -25,13 +25,13 @@
25import gettext25import gettext
26import locale26import locale
2727
28# If Specto is installed read prefix from constants module28
29MESSAGES_DIR = ''29MESSAGES_DIR = ''
30try:30if os.path.exists("/usr/share/locale") and os.path.isdir("/usr/share/locale"):
31 from spectlib.constants import PREFIX31 MESSAGES_DIR = "/usr/share/locale"
32 MESSAGES_DIR = "%s/share/locale" % PREFIX32elif os.path.exists("/usr/local/share/locale") and \
33except ImportError:33 os.path.isdir("/usr/local/share/locale"):
34 pass34 MESSAGES_DIR = "/usr/local/share/locale"
3535
36def setup_locale_and_gettext():36def setup_locale_and_gettext():
37 package_name = 'specto'37 package_name = 'specto'
3838
=== modified file 'spectlib/main.py'
--- spectlib/main.py 2011-06-23 15:23:11 +0000
+++ spectlib/main.py 2011-08-10 10:01:36 +0000
@@ -45,12 +45,7 @@
45from spectlib.tools import networkmanager as conmgr45from spectlib.tools import networkmanager as conmgr
4646
4747
48VERSION = "undefined"48from spectlib import __pkg_version__ as VERSION
49try:
50 from spectlib.constants import VERSION
51except ImportError:
52 with open("VERSION", 'r') as version_file:
53 VERSION = version_file.read().strip()
5449
55#create a gconf object50#create a gconf object
56specto_gconf = Specto_gconf("/apps/specto")51specto_gconf = Specto_gconf("/apps/specto")
5752
=== modified file 'spectlib/util.py'
--- spectlib/util.py 2010-11-23 16:19:28 +0000
+++ spectlib/util.py 2011-08-10 10:01:36 +0000
@@ -26,11 +26,12 @@
2626
27from spectlib.tools.specto_gconf import Specto_gconf27from spectlib.tools.specto_gconf import Specto_gconf
2828
29
29PREFIX = ''30PREFIX = ''
30try:31if os.path.exists("/usr") and os.path.isdir("/usr"):
31 from spectlib.constants import PREFIX32 PREFIX = "/usr"
32except ImportError:33elif os.path.exists("/usr/local") and os.path.isdir("/usr/local"):
33 pass34 PREFIX = "/usr/local"
3435
35def return_webpage(webpage):36def return_webpage(webpage):
36 """ Open the webpage in the default browser. """37 """ Open the webpage in the default browser. """

Subscribers

People subscribed via source and target branches