187 ) |
187 ) |
188 |
188 |
189 for desktop in ["eric7.desktop", "eric7_browser.desktop"]: |
189 for desktop in ["eric7.desktop", "eric7_browser.desktop"]: |
190 copyDesktopFile( |
190 copyDesktopFile( |
191 os.path.join(linuxDir, desktop), |
191 os.path.join(linuxDir, desktop), |
192 os.path.join(dstDir, "applications", desktop), |
192 os.path.join(dstDir, "applications"), |
|
193 desktop, |
193 scriptsDir, |
194 scriptsDir, |
194 ) |
195 ) |
195 |
196 |
196 |
197 |
197 def copyMetaFile(srcname, dstpath, dstname): |
198 def copyMetaFile(srcname, dstpath, dstname): |
210 dstname = os.path.join(dstpath, dstname) |
211 dstname = os.path.join(dstpath, dstname) |
211 shutil.copy2(srcname, dstname) |
212 shutil.copy2(srcname, dstname) |
212 os.chmod(dstname, 0o644) |
213 os.chmod(dstname, 0o644) |
213 |
214 |
214 |
215 |
215 def copyDesktopFile(src, dst, scriptsdir): |
216 def copyDesktopFile(src, dstPath, dstFile, scriptsdir): |
216 """ |
217 """ |
217 Modify a desktop file and write it to its destination. |
218 Modify a desktop file and write it to its destination. |
218 |
219 |
219 @param src source file name (string) |
220 @param src source file name |
220 @param dst destination file name (string) |
221 @type str |
221 @param scriptsdir directory containing the scripts (string) |
222 @param dstPath path name of the directory for the file to be written |
|
223 @type str |
|
224 @param dstFile name of the file to be written |
|
225 @type str |
|
226 @param scriptsdir directory containing the scripts |
|
227 @type str |
222 """ |
228 """ |
223 with open(src, "r", encoding="utf-8") as f: |
229 with open(src, "r", encoding="utf-8") as f: |
224 text = f.read() |
230 text = f.read() |
225 |
231 |
226 text = text.replace("@BINDIR@", scriptsdir) |
232 text = text.replace("@BINDIR@", scriptsdir) |
227 |
233 |
|
234 if not os.path.isdir(dstPath): |
|
235 os.makedirs(dstPath) |
|
236 dst = os.path.join(dstPath, dstFile) |
228 with open(dst, "w", encoding="utf-8") as f: |
237 with open(dst, "w", encoding="utf-8") as f: |
229 f.write(text) |
238 f.write(text) |
230 os.chmod(dst, 0o644) |
239 os.chmod(dst, 0o644) |
231 |
240 |
232 |
241 |