Skip to content

Commit 0903faa

Browse files
committed
change rclone binary location to install
1 parent bed5464 commit 0903faa

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

pyrclone/rclone_wrapper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import subprocess
33
import os
4+
import sys
45

56

67
class RCloneWrapper:
@@ -11,9 +12,9 @@ def __init__(self, cfg):
1112
self.cfg = '\n'.join(f'[{name}]\n' + '\n'.join(f'{k} = {v}' for k,
1213
v in settings.items()) for name, settings in cfg.items())
1314
self.log = logging.getLogger("RClone")
14-
cur_dir = os.path.dirname(os.path.realpath(__file__))
15-
self.config_path = os.path.join(cur_dir, "rclone.conf")
16-
self.rclone_path = os.path.join(cur_dir, "rclone")
15+
wrapper_dir = os.path.dirname(os.path.realpath(__file__))
16+
self.config_path = os.path.join(wrapper_dir, "rclone.conf")
17+
self.rclone_path = os.path.join(sys.prefix, "pyrclone", "rclone")
1718

1819
def _execute(self, command_with_args):
1920
# print(command_with_args)

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
PROJECT_NAME = 'pyrclone'
66
if os.name == 'nt': # Windows
7-
rclone_binary = (f'lib\site-packages\{PROJECT_NAME}', ['win/rclone.exe'])
7+
rclone_binary = (f'{PROJECT_NAME}', ['win/rclone.exe'])
88
elif os.name == 'posix': # Unix-like
99
if os.uname().sysname == 'Linux':
10-
rclone_binary = (f'lib\site-packages\{PROJECT_NAME}', ['linux/rclone'])
10+
rclone_binary = (f'{PROJECT_NAME}', ['linux/rclone'])
1111
elif os.uname().sysname == 'Darwin':
12-
rclone_binary = (f'lib\site-packages\{PROJECT_NAME}', ['mac/rclone'])
12+
rclone_binary = (f'{PROJECT_NAME}', ['mac/rclone'])
1313
else:
1414
raise NotImplementedError('Unsupported OS')
1515

0 commit comments

Comments
 (0)