-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
46 lines (32 loc) · 1.05 KB
/
setup.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from platform import system
from pathlib import Path
from shutil import rmtree, copytree
import warnings
HERE = Path(__file__).parent
def find_win_path():
'''Returns Windows Ableton Live folder.'''
import winreg
# also HKCU\SOFTWARE\Ableton\{...}
reg = winreg.ConnectRegistry(None, winreg.HKEY_CLASSES_ROOT)
value = winreg.QueryValue(reg, r'ableton\Shell\open\command')
path, _ = value.rsplit(' ', 1)
return Path(path).parents[1]
def find_mac_path():
'''Returns MacOS Ableton Live folder.'''
raise NotImplementedError
def install():
if system() == 'Windows':
path = find_win_path() / 'Resources'
print(path)
elif system() == 'Darwin':
path = find_mac_path() / 'Contents/App-Resources'
else:
raise NotImplementedError
path /= 'MIDI Remote Scripts/ClyphX'
if path.exists():
warnings.warn('Removing previous installation')
# TODO: save user settings
rmtree(path)
copytree(HERE / 'src/clyphx', path)
# if __name__ == '__main__':
# install()