Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from limburgher/main
Browse files Browse the repository at this point in the history
Merge Python 3 migration and enhancements.
  • Loading branch information
limburgher authored Nov 21, 2023
2 parents 580222d + a9afa82 commit 8eff375
Show file tree
Hide file tree
Showing 92 changed files with 2,105 additions and 1,776 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- main
pull_request:

name: Tests

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache/restore@v3
id: restore-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install libgtk-3-dev libsdl2-2.0 libwxgtk3.0-gtk3-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
# Install attrdict3 to support the installation of wxPython from source.
# In most cases, wxPython can be installed from wheels, but if those are not available,
# attrdict3 is a prerequisite for installing from source.
# This is currently a requirement for installing wxPython for Python 3.11.
python -m pip install attrdict3
pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 -r requirements.txt
- uses: actions/cache/save@v3
if: steps.restore-cache.outputs.cache-hit != 'true'
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Ensure pytest is available on PATH
run: echo "/opt/trelby/bin" >> "$GITHUB_PATH"

- name: Test with pytest
env:
PYTHONPATH: /opt/trelby
run: pytest
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
*~
*.pyc
*.pyo
.trelby/
*.trelby
!tests/fixtures/*.trelby
.tox/
MANIFEST
.pybuild/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ language: c

install:
- sudo apt-get update -qq
- sudo apt-get install -y python-lxml python-mock
- sudo apt-get install -y python3-lxml python3-mock

script: make test
6 changes: 3 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Installation instructions for Trelby on Linux (tar.gz)
Trelby uses Python's Distutils tool for installation. By default,
it will install everything to /opt/trelby if you run

python setup.py install
python3 setup.py install

Afterwards you can run the program with the command "/opt/trelby/bin/trelby".

If you prefer to install Trelby e.g. to /usr/local, run

sudo python setup.py install --prefix=/usr/local \
sudo python3 setup.py install --prefix=/usr/local \
--install-lib=/usr/local/share/trelby \
--install-data=/usr/local/share

Expand All @@ -20,6 +20,6 @@ your system's path (as is /usr/local/bin).

External dependencies required:

* Python 2.7
* Python 3
* wxWidgets (2.8) and its Python bindings (wxPython)
* lxml
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include dict_en.dat.gz fileformat.txt INSTALL LICENSE manual.html names.txt.gz README sample.trelby setup.py trelby.1.gz trelby.desktop
include dict_en.dat.gz fileformat.txt INSTALL LICENSE manual.html names.txt.gz README.md sample.trelby setup.py trelby.1.gz trelby.desktop
include bin/trelby
recursive-include resources *
recursive-include src *.py
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PREFIX = $(DESTDIR)/usr
.PHONY : clean dist deb

dist: names.txt.gz dict_en.dat.gz manual.html trelby.1.gz
python setup.py sdist
python3 setup.py sdist && cp trelby.1.gz doc/

deb: dist
debuild -us -uc -b
Expand All @@ -21,15 +21,15 @@ trelby.1.gz: doc/*
make -C doc manpage && mv doc/trelby.1.gz .

rpm: dist
python setup.py bdist_rpm
python3 setup.py bdist_rpm

clean:
rm -f bin/*.pyc src/*.pyc tests/*.pyc names.txt.gz dict_en.dat.gz manual.html MANIFEST trelby.1.gz
rm -f bin/*.pyc src/*.pyc tests/*.pyc names.txt.gz dict_en.dat.gz manual.html MANIFEST trelby.1.gz doc/trelby.1.gz
rm -rf build dist
dh_clean

install: dist
python setup.py install
python3 setup.py install

test:
cd tests && ./all.sh
pytest
2 changes: 0 additions & 2 deletions README

This file was deleted.

6 changes: 3 additions & 3 deletions README.dev
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ to inspect/modify the code.
1. Requirements
===============

You will need Python 2.7 and wxWidgets (2.8) and its Python bindings to
You will need Python 3.x and wxWidgets (3.x) and its Python bindings to
run Trelby. You also need the lxml Python library (http://lxml.de/) and
the mock library (https://pypi.python.org/pypi/mock).

Expand Down Expand Up @@ -36,7 +36,7 @@ this, that aspect of the program will not work.
You can run "make dist", which prepares all 4 and also generates a Linux
distribution package which you can ignore.

2.5. Preparing for a Windows build
2.5. Preparing for a Windows build - Out of date
==================================

If you want to create the Windows package, you'll need to place the
Expand Down Expand Up @@ -79,7 +79,7 @@ On Linux:
On Windows:

$ cd \trelby
$ python bin/trelby --test sample.trelby
$ python3 bin/trelby --test sample.trelby

The file t.bat contains the last command.

Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Trelby
## Screenplay writing software
Trelby is a screenplay writing program. See http://www.trelby.org/ for
more details.

### About this project
This is a fork of the original codebase from https://github.com/trelby/trelby, which as of this writing appears to be dormant.

The major difference of this fork is conversion to Python 3. I also have a list of possible enhancements in mind, and I'd love help updating the Windows packaging so that I can provide a Windows build.

### Installation

#### From source

1. git clone https://github.com/limburgher/trelby.git

2. cd trelby

3. pip3 install -r requirements.txt
*Depending on your python version, you might run into https://github.com/wxWidgets/Phoenix/issues/2296. We recommend executing `pip3 install attrdict3` before installing the requirements in that case. If that still doesn't work, we recommend upgrading your python version.*

4. ./bin/trelby

#### Debian and variants

Download and install the .deb file for Ubuntu, Debian, or Raspian here:

https://software.opensuse.org//download.html?project=home%3Agwync&package=trelby

- or -

1. make deb

2. Install the resulting .deb file.

#### Fedora

sudo dnf install trelby

#### Windows

Currently unsupported, see above.
2 changes: 1 addition & 1 deletion bin/trelby
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import sys

Expand Down
4 changes: 2 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rd /s /q dist
rename setup.cfg setup.cfg.bak
python -OO setup.py py2exe
python3 -OO setup.py py2exe
rename setup.cfg.bak setup.cfg
python setup.py nsis
python3 setup.py nsis
55 changes: 55 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
trelby (2.4.9) unstable; urgency=low

* Move PDF generation to reportlab.
* Support non Latin1 characters.

-- Gwyn Ciesla <gwync@protonmail.com> Thu, 21 Sep 2023 14:11:00 +0000

trelby (2.4.8) unstable; urgency=low

* Fixes to diaglog placement, screenplay comparison.

-- Gwyn Ciesla <gwync@protonmail.com> Mon, 24 Oct 2022 14:11:00 +0000

trelby (2.4.7) unstable; urgency=low

* Fix Python < 3.9 compatibility.

-- Gwyn Ciesla <gwync@protonmail.com> Mon, 24 Oct 2022 14:11:00 +0000

trelby (2.4.6) unstable; urgency=low

* Fix Celtx import, et. el.

-- Gwyn Ciesla <gwync@protonmail.com> Mon, 10 Oct 2022 10:05:00 +0000

trelby (2.4.4-1) unstable; urgency=low

* Fix Fountain import

-- Gwyn Ciesla <gwync@protonmail.com> Fri, 22 Jul 2022 08:43:00 +0000

trelby (2.4.3) unstable; urgency=low

* Import/export fixes.

-- Gwyn Ciesla <gwync@protonmail.com> Tue, 02 Mar 2021 11:39:00 +0000

trelby (2.4.2) unstable; urgency=low

* Dictionary fix, deprecate mock.

-- Gwyn Ciesla <gwync@protonmail.com> Tue, 02 Mar 2021 11:39:00 +0000

trelby (2.4.1) unstable; urgency=low

* Fix undo, copy/paste and find/replace bugs.

-- Gwyn Ciesla <gwync@protonmail.com> Tue, 02 Mar 2021 11:39:00 +0000

trelby (2.4) unstable; urgency=low

* Python 3 port.

-- Gwyn Ciesla <gwync@protonmail.com> Fri, 08 Jan 2021 15:28:00 +0000

trelby (2.3-dev) unstable; urgency=low

* New upstream release.
Expand Down
2 changes: 1 addition & 1 deletion debian/compat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8
10
5 changes: 3 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ Source: trelby
Section: python
Priority: extra
Maintainer: Anil Gulecha <anil.verve@gmail.com>
Build-Depends: debhelper (>= 8), python-all (>= 2.7), xsltproc, docbook-xsl, devscripts, fakeroot, python-mock
Build-Depends: debhelper (>= 8), python3-all (>= 3.7), xsltproc, docbook-xsl, devscripts, fakeroot, python3-mock, dh-python, python3-wxgtk4.0, sgml-base, sgml-data, docbook-xml, python3-reportlab, python3-lxml
XS-Python-Version: >= 3.7
Standards-Version: 3.9.4
Homepage: http://www.trelby.org/

Package: trelby
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-wxgtk2.8, python-crypto, python-lxml
Depends: ${misc:Depends}, ${python:Depends}, python3-wxgtk4.0, python3-cryptography, python3-lxml
Description: Feature-rich screenwriting program
Trelby is a simple, powerful, full-featured, multi-platform program for
writing movie screenplays. It is simple, fast and elegantly laid out to
Expand Down
3 changes: 3 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources/icon256.png /usr/share/resources
trelby.desktop /usr/share/applications
doc/trelby.1.gz /usr/share/man/man1
12 changes: 4 additions & 8 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME=trelby
export PYBUILD_INSTALL_ARGS="--install-lib=/usr/share/trelby/ --install-scripts=/usr/bin"
%:
dh $@ --with python2 --buildsystem=python_distutils
dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_install:
dh_auto_install --buildsystem=python_distutils \
-- --prefix=/usr \
--install-data=/usr/share \
--install-lib /usr/share/trelby
dh_auto_install --buildsystem=pybuild
2 changes: 1 addition & 1 deletion debian/source/format
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0 (quilt)
3.0 (native)
Loading

0 comments on commit 8eff375

Please sign in to comment.