mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Debian packaging
This commit is contained in:
parent
6bac63fb5c
commit
e85191b498
7 changed files with 85 additions and 4 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -129,4 +129,6 @@ dmypy.json
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
.vscode
|
.vscode
|
||||||
|
*.tar.gz
|
||||||
|
deb_dist
|
|
@ -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
46
install/linux/build_deb.py
Executable 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()
|
10
install/linux/media.firstlook.dangerzone.desktop
Normal file
10
install/linux/media.firstlook.dangerzone.desktop
Normal 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
|
BIN
install/linux/media.firstlook.dangerzone.png
Normal file
BIN
install/linux/media.firstlook.dangerzone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
20
setup.py
20
setup.py
|
@ -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
6
stdeb.cfg
Normal 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
|
Loading…
Reference in a new issue