Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for the Copy engine #1957

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ test:

clean:
rm -rf __pycache__
rm -rf mackup/__pycache__
rm -rf tests/__pycache__
rm -rf dist/
rm -rf Mackup.egg-info/

release: clean
poetry build
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ in it stay put, so that any other computer also running Mackup is unaffected.

- [Dropbox](https://www.dropbox.com/)
- [Google Drive](https://drive.google.com/)
- [Copy](https://www.copy.com/)
- [iCloud](http://www.apple.com/icloud/)
- Anything able to sync a folder (e.g. [Git](http://git-scm.com/))

Expand Down
7 changes: 1 addition & 6 deletions mackup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
MACKUP_CONFIG_FILE,
ENGINE_DROPBOX,
ENGINE_GDRIVE,
ENGINE_COPY,
ENGINE_ICLOUD,
ENGINE_FS,
)

from .utils import (
error,
get_dropbox_folder_location,
get_copy_folder_location,
get_google_drive_folder_location,
get_icloud_folder_location,
)
Expand Down Expand Up @@ -68,7 +66,7 @@ def engine(self):
"""
The engine used by the storage.

ENGINE_DROPBOX, ENGINE_GDRIVE, ENGINE_COPY, ENGINE_ICLOUD or ENGINE_FS.
ENGINE_DROPBOX, ENGINE_GDRIVE, ENGINE_ICLOUD or ENGINE_FS.

Returns:
str
Expand Down Expand Up @@ -191,7 +189,6 @@ def _parse_engine(self):
if engine not in [
ENGINE_DROPBOX,
ENGINE_GDRIVE,
ENGINE_COPY,
ENGINE_ICLOUD,
ENGINE_FS,
]:
Expand All @@ -210,8 +207,6 @@ def _parse_path(self):
path = get_dropbox_folder_location()
elif self.engine == ENGINE_GDRIVE:
path = get_google_drive_folder_location()
elif self.engine == ENGINE_COPY:
path = get_copy_folder_location()
elif self.engine == ENGINE_ICLOUD:
path = get_icloud_folder_location()
elif self.engine == ENGINE_FS:
Expand Down
1 change: 0 additions & 1 deletion mackup/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
CUSTOM_APPS_DIR = ".mackup"

# Supported engines
ENGINE_COPY = "copy"
ENGINE_DROPBOX = "dropbox"
ENGINE_FS = "file_system"
ENGINE_GDRIVE = "google_drive"
Expand Down
28 changes: 0 additions & 28 deletions mackup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,34 +253,6 @@ def get_google_drive_folder_location():
return googledrive_home


def get_copy_folder_location():
"""
Try to locate the Copy folder.

Returns:
(str) Full path to the current Copy folder
"""
copy_settings_path = "Library/Application Support/Copy Agent/config.db"
copy_home = None

copy_settings = os.path.join(os.environ["HOME"], copy_settings_path)

if os.path.isfile(copy_settings):
database = sqlite3.connect(copy_settings)
if database:
cur = database.cursor()
query = "SELECT value " "FROM config2 " "WHERE option = 'csmRootPath';"
cur.execute(query)
data = cur.fetchone()
copy_home = str(data[0])
cur.close()

if not copy_home:
error(constants.ERROR_UNABLE_TO_FIND_STORAGE.format(provider="Copy install"))

return copy_home


def get_icloud_folder_location():
"""
Try to locate the iCloud Drive folder.
Expand Down
19 changes: 0 additions & 19 deletions tests/config_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from mackup.constants import (
ENGINE_DROPBOX,
ENGINE_GDRIVE,
ENGINE_COPY,
ENGINE_ICLOUD,
ENGINE_FS,
)
Expand Down Expand Up @@ -130,24 +129,6 @@ def test_config_engine_google_drive(self):
assert cfg.apps_to_ignore == set(["subversion", "sequel-pro", "sabnzbd"])
assert cfg.apps_to_sync == set(["sublime-text-3", "x11", "sabnzbd"])

def test_config_engine_copy(self):
cfg = Config("mackup-engine-copy.cfg")

assert isinstance(cfg.engine, str)
assert cfg.engine == ENGINE_COPY

assert isinstance(cfg.path, str)
assert cfg.path == "/Users/someuser/Copy"

assert isinstance(cfg.directory, str)
assert cfg.directory == "Mackup"

assert isinstance(cfg.fullpath, str)
assert cfg.fullpath.endswith("/Copy/Mackup")

assert cfg.apps_to_ignore == set(["subversion", "sequel-pro", "sabnzbd"])
assert cfg.apps_to_sync == set(["sublime-text-3", "x11", "sabnzbd"])

def test_config_engine_icloud(self):
cfg = Config("mackup-engine-icloud.cfg")

Expand Down
Binary file not shown.
12 changes: 0 additions & 12 deletions tests/fixtures/mackup-engine-copy.cfg

This file was deleted.

8 changes: 1 addition & 7 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def test_error(self):
def test_failed_backup_location(self):
"""
Tests for the error that should occur if the backup folder cannot be
found for Dropbox, Google, and Copy
found for Dropbox and Google
"""
# Hack to make our home folder some temporary folder
temp_home = tempfile.mkdtemp()
Expand All @@ -297,12 +297,6 @@ def test_failed_backup_location(self):
)
self.assertRaises(SystemExit, utils.get_google_drive_folder_location)

# Check for the missing Copy Folder
assert not os.path.exists(
os.path.join(temp_home, "Library/Application Support/Copy Agent/config.db")
)
self.assertRaises(SystemExit, utils.get_copy_folder_location)

def test_is_process_running(self):
# A pgrep that has one letter and a wildcard will always return id 1
assert utils.is_process_running("a*")
Expand Down