Repository: lra/mackup

Issue:
Remove-discontinued-service
Copy was discontinued on May 1, 2016. So I had to remove it from Supported storages list.


Discussion:
We'll want to make sure we go through the codebase and remove any copy-related implementation too.

Resolving patch:
diff --git a/mackup/config.py b/mackup/config.py
--- a/mackup/config.py
+++ b/mackup/config.py
@@ -9,7 +9,6 @@
     MACKUP_CONFIG_FILE,
     ENGINE_DROPBOX,
     ENGINE_GDRIVE,
-    ENGINE_COPY,
     ENGINE_ICLOUD,
     ENGINE_FS,
 )
@@ -17,7 +16,6 @@
 from .utils import (
     error,
     get_dropbox_folder_location,
-    get_copy_folder_location,
     get_google_drive_folder_location,
     get_icloud_folder_location,
 )
@@ -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
@@ -191,7 +189,6 @@ def _parse_engine(self):
         if engine not in [
             ENGINE_DROPBOX,
             ENGINE_GDRIVE,
-            ENGINE_COPY,
             ENGINE_ICLOUD,
             ENGINE_FS,
         ]:
@@ -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:
diff --git a/mackup/constants.py b/mackup/constants.py
--- a/mackup/constants.py
+++ b/mackup/constants.py
@@ -22,7 +22,6 @@
 CUSTOM_APPS_DIR = ".mackup"
 
 # Supported engines
-ENGINE_COPY = "copy"
 ENGINE_DROPBOX = "dropbox"
 ENGINE_FS = "file_system"
 ENGINE_GDRIVE = "google_drive"
diff --git a/mackup/utils.py b/mackup/utils.py
--- a/mackup/utils.py
+++ b/mackup/utils.py
@@ -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.


Test patch:
diff --git a/tests/config_tests.py b/tests/config_tests.py
--- a/tests/config_tests.py
+++ b/tests/config_tests.py
@@ -4,7 +4,6 @@
 from mackup.constants import (
     ENGINE_DROPBOX,
     ENGINE_GDRIVE,
-    ENGINE_COPY,
     ENGINE_ICLOUD,
     ENGINE_FS,
 )
@@ -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")
 
diff --git a/tests/fixtures/Library/Application Support/Copy Agent/config.db b/tests/fixtures/Library/Application Support/Copy Agent/config.db
deleted file mode 100644
Binary files a/tests/fixtures/Library/Application Support/Copy Agent/config.db and /dev/null differ
diff --git a/tests/fixtures/mackup-engine-copy.cfg b/tests/fixtures/mackup-engine-copy.cfg
deleted file mode 100644
--- a/tests/fixtures/mackup-engine-copy.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-[storage]
-engine = copy
-
-[applications_to_ignore]
-subversion
-sequel-pro
-sabnzbd
-
-[applications_to_sync]
-sabnzbd
-sublime-text-3
-x11
diff --git a/tests/utils_test.py b/tests/utils_test.py
--- a/tests/utils_test.py
+++ b/tests/utils_test.py
@@ -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()
@@ -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*")