2019-07-31 01:19:55 +02:00
|
|
|
import os, sys, site
|
2017-10-07 15:10:31 +02:00
|
|
|
import subprocess
|
2017-03-10 23:35:06 +01:00
|
|
|
import setuptools
|
|
|
|
|
|
|
|
|
2017-03-14 21:14:58 +01:00
|
|
|
requires = [
|
2017-11-13 15:15:53 +01:00
|
|
|
'babel',
|
2017-07-05 21:59:04 +02:00
|
|
|
'psutil',
|
2020-11-15 23:41:13 +01:00
|
|
|
'croniter',
|
2018-01-04 17:57:36 +01:00
|
|
|
'PyGObject',
|
2023-12-30 18:42:32 +01:00
|
|
|
'packaging',
|
2017-11-13 15:15:53 +01:00
|
|
|
'python-xlib'
|
|
|
|
]
|
2017-03-10 23:35:06 +01:00
|
|
|
|
2017-10-07 15:10:31 +02:00
|
|
|
_ROOT = os.path.abspath(os.path.dirname(__file__))
|
2017-06-21 21:14:31 +02:00
|
|
|
|
2017-10-07 15:10:31 +02:00
|
|
|
with open(os.path.join(_ROOT, 'README.md')) as f:
|
2018-03-30 20:23:56 +02:00
|
|
|
long_description = f.read()
|
2017-03-10 23:35:06 +01:00
|
|
|
|
2017-07-05 21:59:04 +02:00
|
|
|
|
2017-10-07 15:10:31 +02:00
|
|
|
def __compile_po_files():
|
|
|
|
"""
|
|
|
|
Compile the *.po trainslation files.
|
|
|
|
"""
|
|
|
|
localedir = 'safeeyes/config/locale'
|
|
|
|
po_dirs = [localedir + '/' + l + '/LC_MESSAGES/'
|
|
|
|
for l in next(os.walk(localedir))[1]]
|
|
|
|
for po_dir in po_dirs:
|
|
|
|
po_files = [f
|
|
|
|
for f in next(os.walk(po_dir))[2]
|
|
|
|
if os.path.splitext(f)[1] == '.po']
|
|
|
|
for po_file in po_files:
|
2018-03-30 20:23:56 +02:00
|
|
|
filename, _ = os.path.splitext(po_file)
|
2017-10-07 15:10:31 +02:00
|
|
|
mo_file = filename + '.mo'
|
2018-03-30 20:23:56 +02:00
|
|
|
msgfmt_cmd = 'msgfmt {} -o {}'.format(
|
|
|
|
po_dir + po_file, po_dir + mo_file)
|
2017-10-07 15:10:31 +02:00
|
|
|
subprocess.call(msgfmt_cmd, shell=True)
|
|
|
|
|
2017-11-11 16:53:24 +01:00
|
|
|
|
2020-12-31 14:34:27 +01:00
|
|
|
def __data_files():
|
2017-10-07 15:10:31 +02:00
|
|
|
"""
|
|
|
|
Collect the data files.
|
|
|
|
"""
|
2020-12-31 14:34:27 +01:00
|
|
|
root_dir = sys.prefix
|
2023-05-10 11:45:38 +02:00
|
|
|
return [(os.path.join(root_dir, "share/applications"), ["safeeyes/platform/io.github.slgobinath.SafeEyes.desktop"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/24x24/status"), ["safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-enabled.png", "safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-timer.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/24x24/apps"), ["safeeyes/platform/icons/hicolor/24x24/apps/io.github.slgobinath.SafeEyes.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/16x16/status"), ["safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-enabled.png", "safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-timer.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/16x16/apps"), ["safeeyes/platform/icons/hicolor/16x16/apps/io.github.slgobinath.SafeEyes.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/32x32/status"), ["safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-enabled.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/32x32/apps"), ["safeeyes/platform/icons/hicolor/32x32/apps/io.github.slgobinath.SafeEyes.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/64x64/apps"), ["safeeyes/platform/icons/hicolor/64x64/apps/io.github.slgobinath.SafeEyes.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/128x128/apps"), ["safeeyes/platform/icons/hicolor/128x128/apps/io.github.slgobinath.SafeEyes.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/48x48/status"), ["safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-enabled.png"]),
|
|
|
|
(os.path.join(root_dir, "share/icons/hicolor/48x48/apps"), ["safeeyes/platform/icons/hicolor/48x48/apps/io.github.slgobinath.SafeEyes.png"]),]
|
2017-03-15 14:43:28 +01:00
|
|
|
|
2017-11-11 16:53:24 +01:00
|
|
|
|
2017-10-07 15:10:31 +02:00
|
|
|
def __package_files(directory):
|
|
|
|
"""
|
|
|
|
Collect the package files.
|
|
|
|
"""
|
|
|
|
paths = []
|
2018-03-30 20:23:56 +02:00
|
|
|
for (path, _, filenames) in os.walk(directory):
|
2017-10-07 15:10:31 +02:00
|
|
|
for filename in filenames:
|
|
|
|
paths.append(os.path.join('..', path, filename))
|
|
|
|
return paths
|
|
|
|
|
2017-11-11 16:53:24 +01:00
|
|
|
|
2017-10-12 21:49:40 +02:00
|
|
|
def __package_data():
|
|
|
|
"""
|
|
|
|
Return a list of package data.
|
|
|
|
"""
|
|
|
|
__compile_po_files()
|
|
|
|
data = ['glade/*.glade', 'resource/*']
|
|
|
|
data.extend(__package_files('safeeyes/config'))
|
|
|
|
data.extend(__package_files('safeeyes/plugins'))
|
2020-12-26 01:22:57 +01:00
|
|
|
data.extend(__package_files('safeeyes/platform'))
|
2017-10-12 21:49:40 +02:00
|
|
|
return data
|
|
|
|
|
2017-03-10 23:35:06 +01:00
|
|
|
setuptools.setup(
|
|
|
|
name="safeeyes",
|
2024-07-14 22:16:16 +02:00
|
|
|
version="2.2.1",
|
2017-03-10 23:35:06 +01:00
|
|
|
description="Protect your eyes from eye strain using this continuous breaks reminder.",
|
|
|
|
long_description=long_description,
|
2018-03-30 20:23:56 +02:00
|
|
|
long_description_content_type="text/markdown",
|
2017-03-15 01:06:49 +01:00
|
|
|
author="Gobinath Loganathan",
|
2017-03-10 23:35:06 +01:00
|
|
|
author_email="slgobinath@gmail.com",
|
|
|
|
url="https://github.com/slgobinath/SafeEyes",
|
2024-07-14 22:16:16 +02:00
|
|
|
download_url="https://github.com/slgobinath/SafeEyes/archive/v2.2.1.tar.gz",
|
2017-03-10 23:35:06 +01:00
|
|
|
packages=setuptools.find_packages(),
|
2017-10-12 21:49:40 +02:00
|
|
|
package_data={'safeeyes': __package_data()},
|
2020-12-31 14:34:27 +01:00
|
|
|
data_files=__data_files(),
|
2017-03-10 23:35:06 +01:00
|
|
|
install_requires=requires,
|
2017-04-11 01:32:43 +02:00
|
|
|
entry_points={'console_scripts': ['safeeyes = safeeyes.__main__:main']},
|
2017-03-10 23:35:06 +01:00
|
|
|
keywords='linux utility health eye-strain safe-eyes',
|
|
|
|
classifiers=[
|
|
|
|
"Operating System :: POSIX :: Linux",
|
|
|
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
2017-10-12 18:25:49 +02:00
|
|
|
"Development Status :: 5 - Production/Stable",
|
2017-03-10 23:35:06 +01:00
|
|
|
"Environment :: X11 Applications :: GTK",
|
|
|
|
"Intended Audience :: End Users/Desktop",
|
2020-12-17 23:37:53 +01:00
|
|
|
"Topic :: Utilities"] + [('Programming Language :: Python :: %s' % x) for x in '3 3.5 3.6 3.7 3.8 3.9'.split()]
|
2017-03-10 23:35:06 +01:00
|
|
|
)
|