diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f33b9f..f876b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Linters can be run sooner (before installation) - Better messages when an error occurs while parsing the config file - Start converting the code to static types +- Add more information about the dependencies in the documentation ### Fixed - Removed the lasting lint errors (i.e. in main.py) diff --git a/docs/developers.md b/docs/developers.md index d8acd9f..8fcceb9 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -2,6 +2,40 @@ ## Requirements +Diffuse depends on these projects: +* Python 3.8+ +* PyPi +* Cairo and GObject Introspection development headers +* Meson +* Flatpak and Flatpak builder + +### Install the distribution dependencies + +It's a bit difficult to get the command lines for all the distributions and +their releases, but it should be enough to find the packages on other +distributions. + +
+ Debian/Ubuntu + +```sh +sudo apt install python3-pip libcairo2-dev libgirepository1.0-dev meson flatpak flatpak-builder +``` + +_Note: Tested on Debian 11 (Buster) and Ubuntu 20.04 (Focal)_ +
+
+ Fedora + +```sh +sudo dnf install python-pip python3-cairo-devel python3-gobject-devel meson flatpak flatpak-builder +``` + +_Note: Tested on Fedora 34_ +
+ +### Install the project dependencies + To install the requirements just to execute the binary, run: ```sh diff --git a/src/diffuse/preferences.py b/src/diffuse/preferences.py index bc16152..4b0553e 100644 --- a/src/diffuse/preferences.py +++ b/src/diffuse/preferences.py @@ -24,6 +24,7 @@ import shlex import sys from gettext import gettext as _ +from typing import List from diffuse import constants from diffuse import utils @@ -386,7 +387,7 @@ class Preferences: def getEncodings(self): return self.encodings - def _getDefaultEncodings(self) -> list[str]: + def _getDefaultEncodings(self) -> List[str]: return self.string_prefs['encoding_auto_detect_codecs'].split() def getDefaultEncoding(self) -> str: diff --git a/src/diffuse/utils.py b/src/diffuse/utils.py index d4ba21e..9d71012 100644 --- a/src/diffuse/utils.py +++ b/src/diffuse/utils.py @@ -25,7 +25,7 @@ import traceback from enum import IntFlag from gettext import gettext as _ -from typing import Final, Optional, TextIO +from typing import Final, List, Optional, TextIO from diffuse import constants from diffuse.resources import theResources @@ -106,7 +106,7 @@ def logErrorAndDialog(msg: str, parent: Gtk.Widget = None) -> None: dialog.destroy() -def make_subdirs(p: str, ss: list[str]) -> str: +def make_subdirs(p: str, ss: List[str]) -> str: '''Create nested subdirectories and return the complete path.''' for s in ss: p = os.path.join(p, s) @@ -221,7 +221,7 @@ def strip_eol(s: str) -> str: return s -def _strip_eols(ss: list[str]) -> list[str]: +def _strip_eols(ss: List[str]) -> List[str]: '''Returns the list of strings without line ending characters.''' return [strip_eol(s) for s in ss] @@ -232,7 +232,7 @@ def popenReadLines(dn, cmd, prefs, bash_pref, success_results=None): dn, cmd, prefs, bash_pref, success_results).decode('utf-8', errors='ignore'))) -def readconfiglines(fd: TextIO) -> list[str]: +def readconfiglines(fd: TextIO) -> List[str]: return fd.read().replace('\r', '').split('\n') @@ -243,7 +243,7 @@ def globEscape(s: str) -> str: # split string into lines based upon DOS, Mac, and Unix line endings -def splitlines(text: str) -> list[str]: +def splitlines(text: str) -> List[str]: # split on new line characters temp, i, n = [], 0, len(text) while i < n: @@ -272,7 +272,7 @@ def splitlines(text: str) -> list[str]: # also recognize old Mac OS line endings -def readlines(fd: TextIO) -> list[str]: +def readlines(fd: TextIO) -> List[str]: return _strip_eols(splitlines(fd.read())) diff --git a/src/diffuse/vcs/svk.py b/src/diffuse/vcs/svk.py index bb3f670..bd8dfe5 100644 --- a/src/diffuse/vcs/svk.py +++ b/src/diffuse/vcs/svk.py @@ -19,6 +19,8 @@ import os +from typing import Tuple + from diffuse import utils from diffuse.vcs.svn import Svn @@ -33,7 +35,7 @@ class Svk(Svn): return 'Depot Path: ' @staticmethod - def _parseStatusLine(s: str) -> tuple[str, str]: + def _parseStatusLine(s: str) -> Tuple[str, str]: if len(s) < 4 or s[0] not in 'ACDMR': return '', '' return s[0], s[4:] diff --git a/src/diffuse/vcs/svn.py b/src/diffuse/vcs/svn.py index 45cfda2..fc14a56 100644 --- a/src/diffuse/vcs/svn.py +++ b/src/diffuse/vcs/svn.py @@ -21,7 +21,7 @@ import os import glob from gettext import gettext as _ -from typing import Optional +from typing import Optional, Tuple from diffuse import utils from diffuse.vcs.folder_set import FolderSet @@ -44,7 +44,7 @@ class Svn(VcsInterface): return 'URL: ' @staticmethod - def _parseStatusLine(s: str) -> tuple[str, str]: + def _parseStatusLine(s: str) -> Tuple[str, str]: if len(s) < 8 or s[0] not in 'ACDMR': return '', '' # subversion 1.6 adds a new column diff --git a/src/diffuse/vcs/vcs_registry.py b/src/diffuse/vcs/vcs_registry.py index 7232bbe..380c44a 100644 --- a/src/diffuse/vcs/vcs_registry.py +++ b/src/diffuse/vcs/vcs_registry.py @@ -20,7 +20,7 @@ import os from gettext import gettext as _ -from typing import Optional +from typing import List, Optional from diffuse import utils from diffuse.preferences import Preferences @@ -99,7 +99,7 @@ def _get_darcs_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]: def _get_git_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]: if 'GIT_DIR' in os.environ: try: - ss: list[str] = utils.popenReadLines( + ss: List[str] = utils.popenReadLines( path, [ prefs.getString('git_bin'), @@ -185,7 +185,7 @@ def _get_svk_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]: try: # find working copies by parsing the config file with open(svkconfig, 'r', encoding='utf-8') as f: - ss: list[str] = utils.readlines(f) + ss: List[str] = utils.readlines(f) projs, sep = [], os.sep # find the separator character for s in ss: