Skip to content

Commit

Permalink
Merge pull request #353 from jeanslack/improving_build
Browse files Browse the repository at this point in the history
build and requirements
  • Loading branch information
jeanslack authored Jul 28, 2024
2 parents a7d1a5d + 342eb27 commit 47db6ed
Show file tree
Hide file tree
Showing 15 changed files with 376 additions and 152 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Files mentioned in this file will be ignored by git
*__pycache__
*.pyc
*.eggs
*.log
Expand All @@ -25,3 +26,4 @@ Pipfile.lock
portable_data
My_Files
*~
*.mo
15 changes: 15 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ License: GPL3

Change Log:

+------------------------------------+
Sun, 28 July 2024 V.5.0.20

* Added requirements-linux.txt to build videomass wheel from source.
* Update INSTALL file. It now also includes the manual procedure for compiling
the language catalog using included scripts.
* Added *.mo item to .gitignore file to auto-escludes that item.
* Fix pyproject.toml file: added artifacts to include MO files on wheel binary
even if the .gitignore file excludes them.
* Update dependencies list on hatchling.toml file.
* Added `StartupNotify` and `StartupWMClass` entries to xdg/*.desktop file to
fix App icon not dislpayed in some taskbar.
* Improved xdg/*.xml file.
* Fixed app-const.py file to backwards compatibility using wx-Python 4.0.7.

+------------------------------------+
Thue, 18 July 2024 V.5.0.18

Expand Down
167 changes: 135 additions & 32 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
Videomass Installation Instructions and buildings

Application Dependencies
-----------------
VIDEOMASS INSTALLATION INSTRUCTIONS AND BUILDINGS

Required:
=============================
Base application dependencies
=============================

Requires:
- Python >=3.8.0 <=3.12.0
- wxPython-Phoenix >=4.0.7
- PyPubSub >=4.0.3
- requests >=2.26.0
- FFmpeg (included ffplay and ffprobe) >=5.1
Optionals:
- yt-dlp >=2024.04.09
- atomicparsley (to embed thumbnail in audio file)
- atomicparsley (to embed thumbnail in audio file)

=========================
Run from source directory
=========================

Videomass can be run without installing by extratc the source archive
Videomass can be run without installing by extracting the source archive
and executing the "launcher" script inside the source Videomass directory.

cd Videomass
cd Videomass (source directory)

python3 launcher

Expand All @@ -25,57 +31,154 @@ Videomass can also be imported from the Python3 console (interactive mode):
>>> from videomass import gui_app
>>> gui_app.main()

#--------------------------------------------------------------------------#
=====================================
Compiles language translation catalog
=====================================

By default Videomass does not include the compiled catalog for language
translations, i.e. `videomass.mo` files, especially on development source code.
If you want to compile the language catalog to make the translations available
on Videomass, use one of the following options based on your operating system
requirements:

Using `generate_MO_files.sh` shell script (only for Linux, FreeBSD, MacOs)
--------------------------------------------------------------------------

Requires:
- shell (/bin/bash)
- msgfmt (from GNU-gettext)

cd Videomass (source directory)

./develop/gettext_utils/generate_MO_files.sh


Using `babelutils.py` python script (multi-platform)
----------------------------------------------------

Requires:
- babel (also installable via pip)

cd Videomass (source directory)

python3 develop/gettext_utils/babelutils.py --compile-catalogs --output-dir videomass/data/locale --domain videomass


======================
Installation using pip
======================

Requires:
- Python >=3.8.0 <=3.12.0
- pip
- venv


Installing on Linux/FreeBSD:
----------------------------

IMPORTANT!
Before pip install Videomass make sure to install wxPython from your Linux
distribution's package manager. This will prevent pip from attempting to
build wxPython from source, as wxPython's PyPi wheels only provides support
for Windows and MacOS.

This assumes installation in a virtual environment using python3-venv
module with `--system-site-package` option, like this:

python3 -m venv --system-site-packages --upgrade-deps VENV

source VENV/bin/activate

Installing using pip tool: (Linux, MacOs, FreeBSD, Windows, etc.)
To install videomass type:
python3 -m pip install videomass

python3 -m venv VENV
Optionally install yt-dlp:
python3 -m pip install yt-dlp

source VENV/bin/activate

python3 -m pip install --upgrade pip
Installing on Windows and MacOs:
--------------------------------

python3 -m pip install videomass
This assumes installation in a virtual environment using python3-venv
module, like this:

To Update:
python -m venv --upgrade-deps VENV

python3 -m pip install -U videomass
source VENV/bin/activate

To uninstall:
To install videomass type:
python3 -m pip install videomass

Optionally install yt-dlp:
python3 -m pip install yt-dlp


To Update on Windows, MacOs, Linux, FreeBSD:
--------------------------------------------

python3 -m pip install --upgrade videomass


To uninstall on Windows, MacOs, Linux, FreeBSD:
-----------------------------------------------

python3 -m pip uninstall videomass


Please, Visit the Wiki page for more info:
<https://github.com/jeanslack/Videomass/wiki/Installation-using-pip>

#--------------------------------------------------------------------------#
==============================
Build as standalone executable
==============================

Build sdist and wheel (Require python3-hatchling)
This build a standalone executable package only compatible for the operating
system in use. The current supported OS are Windows, MacOs, Linux.

python3 -m build
It is assumed that you are working on a virtual environment created with
the `venv` or `virtualenv` module and that you have installed the `Base
application dependencies` described at the beginning of this file.

For more info visit: <https://packaging.python.org/tutorials/packaging-projects/>
#--------------------------------------------------------------------------#
Requires:
- pyinstaller
- babel

Make a Debian source package from upstream source code:
activate a virtual environment first

This will transform upstream source code into policy-compliant binary packages.
cd Videomass (source directory)

Please, Visit the Videomass Wiki page for istructions:
python3 -m pip install pyinstaller babel

<https://github.com/jeanslack/Videomass/wiki/Packaging-for-Debian-and-derivatives>
Use the `pyinstaller_setup.py` script like this:

python3 develop/tools/pyinstaller_setup.py --gen-spec --build

=====================
Build sdist and wheel
=====================

Requires:
- hatchling
- pkginfo
- build
- wheel
- babel

cd Videomass (source directory)

#--------------------------------------------------------------------------#
python3 -m build

Build as executable (Linux, Windows, MacOs)

require: pyinstaller
For more info visit: <https://packaging.python.org/tutorials/packaging-projects/>

Use the 'develop/tools/pyinstaller_setup.py' script like this

python3 develop/tools/pyinstaller_setup.py -h
======================================================
Make a Debian source package from upstream source code
======================================================

Then choose the option you want.
This will transform upstream source code into policy-compliant binary packages.

#--------------------------------------------------------------------------#
Please, Visit the Videomass Wiki page for istructions:

<https://github.com/jeanslack/Videomass/wiki/Packaging-for-Debian-and-derivatives>
16 changes: 16 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
videomass (5.0.20-1) UNRELEASED; urgency=medium

* Added requirements-linux.txt to build videomass wheel from source.
* Update INSTALL file. It now also includes the manual procedure for compiling
the language catalog using included scripts.
* Added *.mo item to .gitignore file to auto-escludes that item.
* Fix pyproject.toml file: added artifacts to include MO files on wheel binary
even if the .gitignore file excludes them.
* Update dependencies list on hatchling.toml file.
* Added `StartupNotify` and `StartupWMClass` entries to xdg/*.desktop file to
fix App icon not dislpayed in some taskbar.
* Improved xdg/*.xml file.
* Fixed app-const.py file to backwards compatibility using wx-Python 4.0.7.

-- Gianluca Pernigotto <[email protected]> Sun, 28 Jul 2024 12:00:00 +0200

videomass (5.0.18-1) UNRELEASED; urgency=medium

* Created new gettext utilities.
Expand Down
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Build-Depends: debhelper-compat (= 13),
pybuild-plugin-pyproject,
python3-all,
python3-babel,
python3-hatchling
python3-hatchling,
python3-setuptools
Standards-Version: 4.1.4
Homepage: https://github.com/jeanslack/Videomass
X-Python3-Version: >= 3.8
Expand Down
40 changes: 35 additions & 5 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
# Copyleft (c) Videomass Development Team.
# Distributed under the terms of the GPL3 License.
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Name: hatch_build.py
Author: Gianluca Pernigotto <[email protected]>
Copyleft - 2024 Gianluca Pernigotto <[email protected]>
license: GPL3
Rev: July.22.2024
Code checker: flake8, pylint
This file is part of Videomass.
Videomass is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Videomass is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Videomass. If not, see <http://www.gnu.org/licenses/>.
"""

from hatchling.builders.hooks.plugin.interface import BuildHookInterface
from babel.messages.frontend import compile_catalog


class VideomassLanguageBuildHook(BuildHookInterface):
"""
Compile the translation files from their PO-format into
their binary representating MO-format using python `babel`.
"""
def initialize(self, version, build_data):

"""
Compile catalog only if the target includes binary
distribution (wheel). Source distribution (sdist)
does not have to include MO files.
"""
if self.target_name == "wheel":
from babel.messages.frontend import compile_catalog

cmd = compile_catalog()
cmd.directory = "videomass/data/locale/"
cmd.domain = "videomass"
Expand Down
Loading

0 comments on commit 47db6ed

Please sign in to comment.