File: meson_mk_symlink.py

package info (click to toggle)
cinnamon-settings-daemon 6.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,896 kB
  • sloc: ansic: 31,182; xml: 205; python: 61; sh: 50; makefile: 20
file content (25 lines) | stat: -rw-r--r-- 648 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3

import os
import subprocess
import sys

orig_arg = sys.argv[1]
target_arg =sys.argv[2]
exec_name = sys.argv[3]

prefix = os.environ.get('MESON_INSTALL_DESTDIR_PREFIX')

orig_path = os.path.join(prefix, orig_arg, exec_name)
dest_path = os.path.join(prefix, target_arg, exec_name)

if os.path.lexists(dest_path):
    subprocess.call(['unlink', dest_path])

print('Adding symlink %s -> %s' % (orig_path, dest_path))
subprocess.call(['mkdir', '-p', os.path.dirname(dest_path)])

if not os.environ.get('DESTDIR'):
    subprocess.call(['ln', '-s', orig_path, dest_path])
else:
    subprocess.call(['ln', '-rs', orig_path, dest_path])