-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
113 lines (102 loc) · 3.17 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import subprocess
APP_NAME = "pardus-parental-control"
APP_ID = "tr.org.pardus.parental-control"
TRANSLATIONS_FOLDER = "po"
def compile_translations():
mo = []
for po in os.listdir(TRANSLATIONS_FOLDER):
if po.endswith(".po"):
language = po.split(".po")[0]
os.makedirs(f"{TRANSLATIONS_FOLDER}/{language}/LC_MESSAGES", exist_ok=True)
mo_file = f"{TRANSLATIONS_FOLDER}/{language}/LC_MESSAGES/{APP_NAME}.mo"
msgfmt_cmd = f'msgfmt "{TRANSLATIONS_FOLDER}/{po}" -o "{mo_file}"'
subprocess.call(msgfmt_cmd, shell=True)
mo.append((f"/usr/share/locale/{language}/LC_MESSAGES", [mo_file]))
return mo
data_files = [
# Source Code
(
f"/usr/share/pardus/{APP_NAME}/src",
[
"src/Main.py",
"src/PPCActivator.py",
"src/NotificationApp.py",
"src/launch-ppcservice.sh",
],
),
(
f"/usr/share/pardus/{APP_NAME}/src/managers",
[
"src/managers/ApplicationManager.py",
"src/managers/BrowserManager.py",
"src/managers/FileRestrictionManager.py",
"src/managers/LinuxUserManager.py",
"src/managers/MalcontentManager.py",
"src/managers/NetworkFilterManager.py",
"src/managers/PreferencesManager.py",
"src/managers/SmartdnsManager.py",
],
),
# UI
(f"/usr/share/pardus/{APP_NAME}/src/ui", ["src/ui/MainWindow.py"]),
(
f"/usr/share/pardus/{APP_NAME}/src/ui/page",
[
"src/ui/page/PageApplications.py",
"src/ui/page/PageEmpty.py",
"src/ui/page/PageSessionTime.py",
"src/ui/page/PageWebsites.py",
],
),
(
f"/usr/share/pardus/{APP_NAME}/src/ui/widget",
[
"src/ui/widget/DialogAppChooser.py",
"src/ui/widget/ListRowAvatar.py",
"src/ui/widget/PActionRow.py",
"src/ui/widget/PTimeChooserRow.py",
],
),
# Executable
("/usr/bin/", [f"{APP_NAME}"]),
# Data
(
f"/usr/share/pardus/{APP_NAME}/data",
[
"data/style.css",
f"data/{APP_NAME}.svg",
"data/anti-adult.list",
],
),
("/usr/share/icons/hicolor/scalable/apps/", [f"data/{APP_NAME}.svg"]),
# Desktop file
("/usr/share/applications/", [f"{APP_ID}.desktop"]),
# Polkit
(
"/usr/share/polkit-1/actions",
["polkit/tr.org.pardus.pkexec.parental-control.policy"],
),
# Service
(
"/etc/xdg/autostart/",
["data/tr.org.pardus.parental-control.apply.desktop"],
),
] + compile_translations()
setup(
name=f"{APP_NAME}",
version="0.3.3",
packages=find_packages(),
scripts=[f"{APP_NAME}"],
install_requires=["PyGObject"],
data_files=data_files,
author="Pardus Developers",
author_email="[email protected]",
description="Parental Control and Restriction application for Pardus",
license="GPLv3",
keywords="",
url="https://github.com/pardus/pardus-parental-control",
)