-
Notifications
You must be signed in to change notification settings - Fork 236
Package Manuskript for Linux with Stdeb
This guide describes the steps for creating a .deb package for Linux using stdeb.
WARNING: These steps are a Work-In-Progress and do not create a proper functioning package. Steps or files may be missing or incorrect. These steps were hastily thrown together before I put this endeavour on the back-burner.
The purpose of documenting these steps is to capture my work so far, with the hope of later solving all issues so that .deb packages can be created for Manuskript. The reason why I am trying to create .deb packages is that these should be much easier for users to install.
One major stumbling block is the PyQt5 requirement, for which I have not found a work-around.
I used a Virtual Machine containing Debian 9 Stretch 64-bit, that had a pre-existing environment set up to Package Manuskript for Linux with PyInstaller.
I choose Debian Stretch 64-bit because PyQt5 binary wheels are provided for Python v3.5 and later for 64-bit Linux.
- Debian 9 Stretch includes Python v3.5.
- Debian 8 Jessie includes Python v3.4.
The guidelines I roughly followed are contained in:
git clone https://github.com/olivierkes/manuskript.git
cd manuscript
Copy and paste setup.py
from Appendix A located near the end of this
page.
sudo apt-get install python3-pip
# Needed for "...stdeb.command bdist_deb" command
sudo apt-get install python3-stdeb
See PyPA - Installing pip/setuptools/wheel with Linux Package Managers.
I installed the required software for building GParted. See GParted README under the INSTALL section, Building from Source, Debian or Ubuntu dependencies.
To Be Done - identify minimal set of software required.
sudo apt-get install python3-pip
sudo apt-get install libxml2-dev libxslt1-dev
Try to create packages:
python3 setup.py sdist
Runs to completion.
python3 setup.py bdist_wheel
Runs to completion.
python3 setup.py --command-packages=stdeb.command bdist_deb
Fails to runs to completion.
Using Virtual Python environment is great for testing.
-
Install the prerequisite venv software.
sudo apt-get install python3-venv
-
Create the virtual environment
mkdir -p ~/myVenv python3 -m venv ~/myVenv/manuskript
-
Activate the virtual environment
. ~/myVenv/manuskript/bin/activate
With venv python virtual environment activated:
# Installs PyQt5 binary wheel which cannot be required in setup.py file
pip3 install pyqt5
python3 setup.py install
Note: All required software installs with the exception of pyqt5
.
- StackOverflow - Is it possible to require PyQt from setuptools setup.py?
- StackOverflow - Can I use setup.py to pack an app that requires PyQt5?
- Installing PyQt... because it’s too good for pip or easy_install.
- stdeb - Python to Debian source package conversion utility
WARNING: This is a Work-In-Progress only and is not finished.
----- begin setup.py -----
""" setup.py - A setuptools based setup module.
Copyright (C) 2017 Olivier Keshavjee
This file is part of Manuskript.
Manuskript 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.
Manuskript 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 Manuskript. If not, see <http://www.gnu.org/licenses/>.
A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
import sys
from manuskript.version import getVersion
here = path.abspath(path.dirname(__file__))
sys.path.insert(0, path.dirname(path.abspath(__file__)))
setup(
name='manuskript',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=getVersion(),
description='An open source tool for writers',
long_description=('Manuskript is an open source tool for writers. It '
'provides a rich environment to help writers create '
'their first draft and then further refine and edit '
'their masterpiece.'),
# The project's main homepage.
url='https://github.com/olivierkes/manuskript',
# Author details
author='Olivier Keshavjee',
author_email='[email protected]',
# Choose your license
license='GPL-3',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: End Users/Desktop',
'Topic :: Office/Business',
'Topic :: Text Processing',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
# Specify operating system
'Operating System :: OS Independent',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
#'Programming Language :: Python :: 3',
#'Programming Language :: Python :: 3.2',
#'Programming Language :: Python :: 3.3',
#'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
# What does your project relate to?
keywords='manuskript office writing editing',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
# py_modules=["my_module"],
# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
#
# NOTE: PyQt5 cannot be required in setup.py and must be
# installed separately. Use:
# pip3 install pyqt5
# See:
# https://stackoverflow.com/questions/4628519/is-it-possible-to-require-pyqt-from-setuptools-setup-py
# http://movingthelamppost.com/blog/html/2013/07/12/installing_pyqt____because_it_s_too_good_for_pip_or_easy_install_.html
install_requires=['pyqt5', 'lxml', 'markdown', 'pyenchant'],
# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
#extras_require={
# 'dev': ['check-manifest'],
# 'test': ['coverage'],
#},
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
package_data={
'i18n': ['i18n'],
'icons': ['icons'],
'libs': ['libs'],
'resources': ['resources'],
'sample-projects': ['sample-projects'],
},
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
#data_files=[('share/applications/', ['manuskript.desktop'])],
# Premade Scripts
scripts=['bin/manuskript'],
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
#entry_points={
# 'console_scripts': [
# 'manuskript=manuskript:main',
# ],
#},
)
----- end setup.py -----