Skip to content

Commit 1dc861f

Browse files
authored
Merge pull request #1 from MrLYG/ci
add github action and change the path of installing rclone binary file.
2 parents 4a6bb7b + b7be00a commit 1dc861f

3 files changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/_linux_test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: linux-test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
pytest:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: '3.10'
16+
- name: Install dependencies
17+
run: |
18+
pip install . -v
19+
pip install pytest
20+
- name: Update permissions
21+
run: |
22+
sudo chmod 755 /opt/hostedtoolcache/Python/3.10.12/x64/pyrclone/rclone
23+
- name: Test with pytest
24+
run: |
25+
make test

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
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

1616
setuptools.setup(
1717
name="PyRCloneTest",
18-
version="0.0.1-v1.62.2",
18+
version="0.0.1",
1919
author="Yuangang Li",
2020
author_email="yuangangli@outlook.com",
2121
description="A package that provides a wrapper for RClone",

0 commit comments

Comments
 (0)