Debian Codegraph @

install/build-desktop-file

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/env python
2
3 from optparse import OptionParser
4 from os import makedirs, sep
5 from os.path import abspath, dirname, isdir, join
6
7 from util import (
8 getResourcesDirectory,
9 getTemplatesDirectory,
10 writeTemplate
11 )
12
13 def main():
14 parser = OptionParser("usage: %prog [options] binDir dataDir")
15 parser.add_option("-d", "--desktop-file", action="store",
16 default=join(getResourcesDirectory(),
17 "midisnoop.desktop"),
18 dest="desktopFile", help="Desktop file destination")
19 options, args = parser.parse_args()
20 if len(args) != 2:
21 parser.error("incorrect number of required arguments")
22
23 desktopFile = options.desktopFile
24 desktopDir = dirname(desktopFile)
25 if not isdir(desktopDir):
26 makedirs(desktopDir)
27 data = {
28 "binDir": abspath(args[0]),
29 "dataDir": abspath(args[1])
30 }
31 writeTemplate(desktopFile,
32 join(getTemplatesDirectory(), "midisnoop.desktop"), data)
33
34 if __name__ == "__main__":
35 main()