Skip to content

Commit c224d17

Browse files
authored
Merge pull request #141 from MightyCreak/docs-add-dependencies
Add project dependencies and fix Python 3.8 compatibility
2 parents 3222cfe + 0bf760f commit c224d17

File tree

7 files changed

+51
-13
lines changed

7 files changed

+51
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Linters can be run sooner (before installation)
2424
- Better messages when an error occurs while parsing the config file
2525
- Start converting the code to static types
26+
- Add more information about the dependencies in the documentation
2627

2728
### Fixed
2829
- Removed the lasting lint errors (i.e. in main.py)

docs/developers.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
## Requirements
44

5+
Diffuse depends on these projects:
6+
* Python 3.8+
7+
* PyPi
8+
* Cairo and GObject Introspection development headers
9+
* Meson
10+
* Flatpak and Flatpak builder
11+
12+
### Install the distribution dependencies
13+
14+
It's a bit difficult to get the command lines for all the distributions and
15+
their releases, but it should be enough to find the packages on other
16+
distributions.
17+
18+
<details>
19+
<summary>Debian/Ubuntu</summary>
20+
21+
```sh
22+
sudo apt install python3-pip libcairo2-dev libgirepository1.0-dev meson flatpak flatpak-builder
23+
```
24+
25+
_Note: Tested on Debian 11 (Buster) and Ubuntu 20.04 (Focal)_
26+
</details>
27+
<details>
28+
<summary>Fedora</summary>
29+
30+
```sh
31+
sudo dnf install python-pip python3-cairo-devel python3-gobject-devel meson flatpak flatpak-builder
32+
```
33+
34+
_Note: Tested on Fedora 34_
35+
</details>
36+
37+
### Install the project dependencies
38+
539
To install the requirements just to execute the binary, run:
640

741
```sh

src/diffuse/preferences.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import sys
2525

2626
from gettext import gettext as _
27+
from typing import List
2728

2829
from diffuse import constants
2930
from diffuse import utils
@@ -386,7 +387,7 @@ def setString(self, name: str, value: str) -> None:
386387
def getEncodings(self):
387388
return self.encodings
388389

389-
def _getDefaultEncodings(self) -> list[str]:
390+
def _getDefaultEncodings(self) -> List[str]:
390391
return self.string_prefs['encoding_auto_detect_codecs'].split()
391392

392393
def getDefaultEncoding(self) -> str:

src/diffuse/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from enum import IntFlag
2727
from gettext import gettext as _
28-
from typing import Final, Optional, TextIO
28+
from typing import Final, List, Optional, TextIO
2929

3030
from diffuse import constants
3131
from diffuse.resources import theResources
@@ -106,7 +106,7 @@ def logErrorAndDialog(msg: str, parent: Gtk.Widget = None) -> None:
106106
dialog.destroy()
107107

108108

109-
def make_subdirs(p: str, ss: list[str]) -> str:
109+
def make_subdirs(p: str, ss: List[str]) -> str:
110110
'''Create nested subdirectories and return the complete path.'''
111111
for s in ss:
112112
p = os.path.join(p, s)
@@ -221,7 +221,7 @@ def strip_eol(s: str) -> str:
221221
return s
222222

223223

224-
def _strip_eols(ss: list[str]) -> list[str]:
224+
def _strip_eols(ss: List[str]) -> List[str]:
225225
'''Returns the list of strings without line ending characters.'''
226226
return [strip_eol(s) for s in ss]
227227

@@ -232,7 +232,7 @@ def popenReadLines(dn, cmd, prefs, bash_pref, success_results=None):
232232
dn, cmd, prefs, bash_pref, success_results).decode('utf-8', errors='ignore')))
233233

234234

235-
def readconfiglines(fd: TextIO) -> list[str]:
235+
def readconfiglines(fd: TextIO) -> List[str]:
236236
return fd.read().replace('\r', '').split('\n')
237237

238238

@@ -243,7 +243,7 @@ def globEscape(s: str) -> str:
243243

244244

245245
# split string into lines based upon DOS, Mac, and Unix line endings
246-
def splitlines(text: str) -> list[str]:
246+
def splitlines(text: str) -> List[str]:
247247
# split on new line characters
248248
temp, i, n = [], 0, len(text)
249249
while i < n:
@@ -272,7 +272,7 @@ def splitlines(text: str) -> list[str]:
272272

273273

274274
# also recognize old Mac OS line endings
275-
def readlines(fd: TextIO) -> list[str]:
275+
def readlines(fd: TextIO) -> List[str]:
276276
return _strip_eols(splitlines(fd.read()))
277277

278278

src/diffuse/vcs/svk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import os
2121

22+
from typing import Tuple
23+
2224
from diffuse import utils
2325
from diffuse.vcs.svn import Svn
2426

@@ -33,7 +35,7 @@ def _getURLPrefix() -> str:
3335
return 'Depot Path: '
3436

3537
@staticmethod
36-
def _parseStatusLine(s: str) -> tuple[str, str]:
38+
def _parseStatusLine(s: str) -> Tuple[str, str]:
3739
if len(s) < 4 or s[0] not in 'ACDMR':
3840
return '', ''
3941
return s[0], s[4:]

src/diffuse/vcs/svn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import glob
2222

2323
from gettext import gettext as _
24-
from typing import Optional
24+
from typing import Optional, Tuple
2525

2626
from diffuse import utils
2727
from diffuse.vcs.folder_set import FolderSet
@@ -44,7 +44,7 @@ def _getURLPrefix() -> str:
4444
return 'URL: '
4545

4646
@staticmethod
47-
def _parseStatusLine(s: str) -> tuple[str, str]:
47+
def _parseStatusLine(s: str) -> Tuple[str, str]:
4848
if len(s) < 8 or s[0] not in 'ACDMR':
4949
return '', ''
5050
# subversion 1.6 adds a new column

src/diffuse/vcs/vcs_registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import os
2121

2222
from gettext import gettext as _
23-
from typing import Optional
23+
from typing import List, Optional
2424

2525
from diffuse import utils
2626
from diffuse.preferences import Preferences
@@ -99,7 +99,7 @@ def _get_darcs_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]:
9999
def _get_git_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]:
100100
if 'GIT_DIR' in os.environ:
101101
try:
102-
ss: list[str] = utils.popenReadLines(
102+
ss: List[str] = utils.popenReadLines(
103103
path,
104104
[
105105
prefs.getString('git_bin'),
@@ -185,7 +185,7 @@ def _get_svk_repo(path: str, prefs: Preferences) -> Optional[VcsInterface]:
185185
try:
186186
# find working copies by parsing the config file
187187
with open(svkconfig, 'r', encoding='utf-8') as f:
188-
ss: list[str] = utils.readlines(f)
188+
ss: List[str] = utils.readlines(f)
189189
projs, sep = [], os.sep
190190
# find the separator character
191191
for s in ss:

0 commit comments

Comments
 (0)