Debian packaging

This commit is contained in:
Micah Lee 2020-01-07 17:10:54 -08:00
parent 6bac63fb5c
commit e85191b498
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
7 changed files with 85 additions and 4 deletions

4
.gitignore vendored
View file

@ -129,4 +129,6 @@ dmypy.json
.pyre/ .pyre/
# Other # Other
.vscode .vscode
*.tar.gz
deb_dist

View file

@ -222,7 +222,8 @@ class Common(object):
"share", "share",
) )
else: else:
print("Error, can only run in dev mode so far") # In linux...
prefix = os.path.join(sys.prefix, "share/dangerzone")
resource_path = os.path.join(prefix, filename) resource_path = os.path.join(prefix, filename)
return resource_path return resource_path

46
install/linux/build_deb.py Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import subprocess
import shutil
sys.path.insert(
0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
)
import dangerzone
version = dangerzone.dangerzone_version
root = os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
)
def run(cmd):
subprocess.run(cmd, cwd=root, check=True)
def main():
dist_path = os.path.join(root, "dist")
deb_dist_path = os.path.join(root, "deb_dist")
print("* Deleting old dist and deb_dist")
if os.path.exists(dist_path):
shutil.rmtree(dist_path)
if os.path.exists(deb_dist_path):
shutil.rmtree(deb_dist_path)
print("* Building DEB package")
run(["python3", "setup.py", "--command-packages=stdeb.command", "bdist_deb"])
run(["python3", "setup.py", "--command-packages=stdeb.command", "sdist_dsc"])
print("")
print("* To install run:")
print("sudo dpkg -i deb_dist/dangerzone_{}-1_all.deb".format(version))
if __name__ == "__main__":
main()

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=dangerzone
GenericName=dangerzone
Comment=Take potentially dangerous PDFs, office documents, or images and convert them to a safe PDF
Exec=dangerzone %f
Terminal=false
Type=Application
Icon=media.firstlook.dangerzone
Categories=Office;Utility;OCR;Security
MimeType=application/pdf;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -5,17 +5,33 @@ import sys
from dangerzone import dangerzone_version from dangerzone import dangerzone_version
def file_list(path):
files = []
for filename in os.listdir(path):
if os.path.isfile(os.path.join(path, filename)):
files.append(os.path.join(path, filename))
return files
setuptools.setup( setuptools.setup(
name="dangerzone", name="dangerzone",
version=dangerzone_version, version=dangerzone_version,
author="Micah Lee", author="Micah Lee",
author_email="micah.lee@theintercept.com", author_email="micah.lee@theintercept.com",
license="MIT", license="MIT",
description="Take arbitrary untrusted PDFs, office documents, or images and convert them to a trusted PDF", description="Take potentially dangerous PDFs, office documents, or images and convert them to a safe PDF",
url="https://github.com/firstlookmedia/dangerzone", url="https://github.com/firstlookmedia/dangerzone",
packages=["dangerzone"], packages=["dangerzone"],
data_files=[
("share/applications", ["install/linux/media.firstlook.dangerzone.desktop"],),
(
"share/icons/hicolor/64x64/apps",
["install/linux/media.firstlook.dangerzone.png"],
),
("share/dangerzone", file_list("share")),
("share/dangerzone/container", file_list("share/container")),
],
classifiers=( classifiers=(
"Development Status :: 4 - Beta",
"Programming Language :: Python", "Programming Language :: Python",
"Intended Audience :: End Users/Desktop", "Intended Audience :: End Users/Desktop",
"Operating System :: OS Independent", "Operating System :: OS Independent",

6
stdeb.cfg Normal file
View file

@ -0,0 +1,6 @@
[DEFAULT]
Package3: dangerzone
Depends3: python3, python3-pyqt5, python3-appdirs, python3-click, python3-xdg
Build-Depends: python3, python3-all
Suite: bionic
X-Python3-Version: >= 3.7