Skip to content

Commit

Permalink
Merge master into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed May 5, 2024
2 parents afdfc58 + 90e2b79 commit 3cb641f
Show file tree
Hide file tree
Showing 57 changed files with 290 additions and 249 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build
uses: dawidd6/action-debian-package@v1.4.4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
LDFLAGS: -L/usr/local/opt/python@${python_version}/lib
PKG_CONFIG_PATH: /usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/python@${python_version}/lib/pkgconfig:${PKG_CONFIG_PATH:-}
steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v4.4.0
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Install macOS Dependencies
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
os: [macos-12, macos-13, ubuntu-20.04, ubuntu-22.04]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Show environment
run: |
Expand All @@ -36,26 +36,34 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -y install -qq gettext gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-gtksource-4 gir1.2-pango-1.0 gir1.2-webkit2-4.0 python3 python3-enchant python3-gi python3-yaml
python3 -m pip install setuptools tox
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
# We need pygobject from PyPI. Using only pygobject3 from homebrew leads to "gi module not found".
brew install gettext gtk+3 gobject-introspection glib libffi cairo gtksourceview3 atk librsvg gsettings-desktop-schemas adwaita-icon-theme enchant
python3 -m pip install pyenchant pygobject pyyaml
# Homebrew complains about python@3.12 files that are overwritten, so we remove them.
# Some can be removed by unlinking python@3.12, others need to be removed manually.
brew unlink python@3.12
brew link --overwrite python@3.12
sudo rm -r /usr/local/bin/2to3 /usr/local/bin/idle3 /usr/local/bin/pydoc3 /usr/local/bin/python3 /usr/local/bin/python3-config /usr/local/share/man/man1/python3.1 /usr/local/lib/pkgconfig/python3-embed.pc /usr/local/lib/pkgconfig/python3.pc /usr/local/Frameworks/Python.framework/Headers /usr/local/Frameworks/Python.framework/Python /usr/local/Frameworks/Python.framework/Resources /usr/local/Frameworks/Python.framework/Versions/Current
brew install gettext gobject-introspection gtk+3 libffi cairo gtksourceview3 librsvg adwaita-icon-theme enchant
# Removing the Python files above makes pip complain about "managed environments", so we need to "break system packages".
python3 -m pip install --break-system-packages pyenchant pygobject pyyaml
python3 -m pip install --break-system-packages setuptools tox
env:
# https://docs.brew.sh/Manpage#install-options-formulacask-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: on

- name: Install common dependencies
run: |
python3 -m pip install setuptools tox
HOMEBREW_NO_INSTALL_CLEANUP: on
HOMEBREW_NO_INSTALL_UPGRADE: on

- name: Check style
if: matrix.os == 'ubuntu-22.04'
run: |
python3 -m tox -v -e style
- name: Run tests
if: matrix.os == 'ubuntu-22.04' # pip on macOS needs --break-system-packages
run: |
python3 -c "import gi"
python3 -m tox -v -e py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build page
run: ./web/build.sh
- name: Setup Pages
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ debian/files
debian/rednotebook.postinst.debhelper
debian/rednotebook.prerm.debhelper
debian/rednotebook.substvars
test-translations/
54 changes: 45 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: black
language_version: python3
exclude: rednotebook/external/.*\.py
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
# Static analysis for Python code
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: pyupgrade
exclude: rednotebook/external/.*\.py
- id: flake8
# E203: whitespace before ':' (not compliant with PEP 8)
# E402: module level import not at top of file
# F821: undefined name "_"
args: ['--extend-ignore=E203,E402,F821', '--max-line-length=110', '--builtins="_"']
exclude: ^rednotebook/external/

# Python code formatter
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
exclude: ^rednotebook/external/

# Imports sorter
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
exclude: ^rednotebook/journal.py

# Upgrades Python code to a target version
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args: ['--py36-plus', '--exit-zero']
exclude: ^rednotebook/external/

# Finds unused Python code
- repo: https://github.com/jendrikseipp/vulture
rev: v2.7
hooks:
- id: vulture
exclude: ^rednotebook/external/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.33 (2024-05-05)
* Ignore image filenames and web links in word clouds (#537, #696, @laraconda).
* Add more pre-commit checks (#705, @laraconda).

# 2.32 (2024-02-17)
* Allow copying text in preview mode (#732, Jendrik Seipp).
* Allow hashtags that start with (but are longer than) hex colors and preprocessor directives (#738, Jendrik Seipp).
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Start RedNotebook:
* Windows: `py rednotebook/journal.py`


## Set up pre-commit hooks

Install [pre-commit](https://pre-commit.com/), then run `pre-commit install`.


## Run tests

Install [tox](https://tox.wiki), then run `tox`.


## Thanks to

* The authors of the libraries listed under 'Requirements'.
Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
rednotebook (2.33-1) UNRELEASED; urgency=low

* New upstream release
* Ignore image filenames and web links in word clouds (#537, #696, @laraconda).
* Add more pre-commit checks (#705, @laraconda).

-- Jendrik Seipp <jendrikseipp@web.de> Sun, 05 May 2024 19:26:46 +0200

rednotebook (2.32-1) UNRELEASED; urgency=low

* New upstream release
Expand Down
8 changes: 4 additions & 4 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ License: GPL-2+

Files: debian/*
Copyright: Copyright (C) 2008, 2009 Jonathan Wiltshire <debian@jwiltshire.org.uk>
Copyright (C) 2008-2022 Jendrik Seipp <jendrikseipp@gmail.com>
Copyright (C) 2017-2022 Phil Wyett <philip.wyett@kathenas.org>
Copyright (C) 2008-2024 Jendrik Seipp <jendrikseipp@gmail.com>
Copyright (C) 2017-2024 Phil Wyett <philip.wyett@kathenas.org>
License: GPL-2+

Files: data/rednotebook.appdata.xml
Copyright: Copyright (C) 2008-2022 Jendrik Seipp <jendrikseipp@gmail.com>
Copyright (C) 2017-2022 Phil Wyett <philip.wyett@kathenas.org>
Copyright: Copyright (C) 2008-2024 Jendrik Seipp <jendrikseipp@gmail.com>
Copyright (C) 2017-2024 Phil Wyett <philip.wyett@kathenas.org>
License: CC0-1.0

License: CC0-1.0
Expand Down
3 changes: 2 additions & 1 deletion debian/source_rednotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@

from apport.hookutils import attach_file_if_exists


LOGS = (("DebugLog", "rednotebook.log"),)


def add_info(report):
report["CrashDB"] = "rednotebook"
rednotebook_dir = path.join(os.environ["HOME"], ".rednotebook")
for (key, name) in LOGS:
for key, name in LOGS:
log = path.join(rednotebook_dir, name)
attach_file_if_exists(report, log, key)
5 changes: 2 additions & 3 deletions dev/benchmarks/findall.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import timeit


DIR = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(DIR))

Expand All @@ -16,8 +17,6 @@
for text in TEXTS:
timer = timeit.Timer(
"HASHTAG.findall(text)",
setup='from rednotebook.data import HASHTAG; text = "{text}"'.format(
**locals()
),
setup=f'from rednotebook.data import HASHTAG; text = "{text}"',
)
print(text[:10], timer.timeit(ITERATIONS))
8 changes: 6 additions & 2 deletions dev/build_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
from pathlib import Path
import subprocess
import sys


REPO = Path(__file__).resolve().parents[1]
Expand All @@ -22,8 +23,10 @@ def build_translation_files(po_dir: Path, locale_dir: Path):
dest_dir = dest.parent
if not dest_dir.exists():
dest_dir.mkdir(parents=True, exist_ok=True)
print(f"Compiling {src} to {dest}")
subprocess.check_call(["msgfmt", "--output-file", dest, src])
try:
subprocess.check_call(["msgfmt", "--output-file", dest, src])
except subprocess.CalledProcessError:
sys.exit(f"Compilation failed for {src}")


def main():
Expand All @@ -33,6 +36,7 @@ def main():
print("Building translations")
print(po_dir, "-->", locale_dir)
build_translation_files(po_dir, locale_dir)
print("Finished building translations")


if __name__ == "__main__":
Expand Down
22 changes: 0 additions & 22 deletions dev/check-style.sh

This file was deleted.

2 changes: 2 additions & 0 deletions dev/generate-help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
import sys


DIR = Path(__file__).resolve().parent
REPO = DIR.parent
DEFAULT_DATA_DIR = Path.home() / ".rednotebook" / "data"
Expand All @@ -13,6 +14,7 @@
from rednotebook.info import version
from rednotebook.util import markup


print(
markup.convert(
help_text,
Expand Down
17 changes: 17 additions & 0 deletions dev/whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import gi


gi.require_version("Gtk", "3.0")


Expand All @@ -21,12 +22,14 @@ def __getattr__(self, _):

from rednotebook.journal import Journal


Journal.do_activate
Journal.do_command_line
Journal.do_startup

from gi.repository import Gtk


cell = Gtk.CellRendererText()
cell.props.wrap_mode

Expand All @@ -39,7 +42,21 @@ def __getattr__(self, _):
# CEF Browser
from ctypes import _CFuncPtr


_CFuncPtr.argtypes
_CFuncPtr.restype
Dummy().OnBeforeBrowse
sys.excepthook

Dummy().commandline_help
Dummy().greeting
Dummy().intro
Dummy().help_par
Dummy().preview_par
Dummy().tags_par
Dummy().temp_par
Dummy().save
Dummy().save_par
Dummy().error_par
Dummy().goodbye_par
Dummy().example_entry
13 changes: 6 additions & 7 deletions po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: rednotebook\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-02 08:57+0200\n"
"PO-Revision-Date: 2023-04-29 13:37+0100\n"
"Last-Translator: albanobattistella <albano_battistella@hotmail.com>\n"
"PO-Revision-Date: 2024-02-18 19:00+0100\n"
"Last-Translator: albanobattistella <albanobattistella@gmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/rednotebook/"
"desktop-app/it/>\n"
"Language: it\n"
Expand Down Expand Up @@ -252,7 +252,7 @@ msgstr "Elenco puntato"

#: ../rednotebook/gui/insert_menu.py:173
msgid "Numbered List"
msgstr ""
msgstr "Elenco numerato"

#: ../rednotebook/gui/insert_menu.py:178
msgid "Title"
Expand Down Expand Up @@ -317,7 +317,7 @@ msgstr "Non è stata inserita la posizione del collegamento"

#: ../rednotebook/gui/search.py:102
msgid "Replace"
msgstr ""
msgstr "Sostituisci"

#: ../rednotebook/gui/search.py:125 ../rednotebook/gui/exports.py:416
msgid "Date"
Expand All @@ -329,7 +329,7 @@ msgstr "Testo"

#: ../rednotebook/gui/customwidgets.py:48
msgid "Search"
msgstr ""
msgstr "Cerca"

#: ../rednotebook/gui/customwidgets.py:339
msgid "Save and insert"
Expand Down Expand Up @@ -1013,10 +1013,9 @@ msgid "Replaced {total_replacements} occurrences of the search text"
msgstr ""

#: ../rednotebook/journal.py:587
#, fuzzy
#| msgid "No text or tag has been selected."
msgid "No text has been replaced"
msgstr "Non è stato selezionato alcun testo o etichetta"
msgstr "Nessun testo è stato sostituito"

#: ../rednotebook/backup.py:58
#, python-format
Expand Down
Loading

0 comments on commit 3cb641f

Please sign in to comment.