[meld/deprecation-cleanup: 32/48] conf: Move to pathlib use



commit 91c3f4e272713e89433722fb4d4ee5d60e486730
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Dec 2 07:32:32 2018 +1000

    conf: Move to pathlib use
    
    No real reason other than that it's just more readable here.

 meld/conf.py     | 15 ++++++++-------
 meld/settings.py |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/meld/conf.py b/meld/conf.py
index 2511a967..504c3c6e 100644
--- a/meld/conf.py
+++ b/meld/conf.py
@@ -1,6 +1,7 @@
 
 import os
 import sys
+from pathlib import Path
 
 __package__ = "meld"
 __version__ = "3.19.2"
@@ -8,13 +9,13 @@ __version__ = "3.19.2"
 APPLICATION_ID = "org.gnome.meld"
 
 # START; these paths are clobbered on install by meld.build_helpers
-DATADIR = os.path.join(sys.prefix, "share", "meld")
-LOCALEDIR = os.path.join(sys.prefix, "share", "locale")
+DATADIR = Path(sys.prefix) / "share" / "meld"
+LOCALEDIR = Path(sys.prefix) / "share" / "locale"
 # END
 
 # Flag enabling some workarounds if data dir isn't installed in standard prefix
 DATADIR_IS_UNINSTALLED = False
-PYTHON_REQUIREMENT_TUPLE = (3, 3)
+PYTHON_REQUIREMENT_TUPLE = (3, 4)
 
 
 # Installed from main script
@@ -38,11 +39,11 @@ def frozen():
 
 def uninstalled():
     global DATADIR, LOCALEDIR, DATADIR_IS_UNINSTALLED
-    melddir = os.path.abspath(os.path.join(
-        os.path.dirname(os.path.realpath(__file__)), ".."))
 
-    DATADIR = os.path.join(melddir, "data")
-    LOCALEDIR = os.path.join(melddir, "build", "mo")
+    melddir = Path(__file__).resolve().parent.parent
+
+    DATADIR = melddir / "data"
+    LOCALEDIR = melddir / "build" / "mo"
     DATADIR_IS_UNINSTALLED = True
 
 
diff --git a/meld/settings.py b/meld/settings.py
index 8b0c5dde..601e9028 100644
--- a/meld/settings.py
+++ b/meld/settings.py
@@ -78,7 +78,7 @@ class MeldSettings(GObject.GObject):
 def load_settings_schema(schema_id):
     if meld.conf.DATADIR_IS_UNINSTALLED:
         schema_source = Gio.SettingsSchemaSource.new_from_directory(
-            meld.conf.DATADIR,
+            str(meld.conf.DATADIR),
             Gio.SettingsSchemaSource.get_default(),
             False,
         )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]