File: setup.py

package info (click to toggle)
fenrir 1.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,672 kB
  • sloc: python: 10,700; sh: 387; makefile: 12
file content (123 lines) | stat: -rwxr-xr-x 4,321 bytes parent folder | download | duplicates (2)
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
114
115
116
117
118
119
120
121
122
123
#!/bin/python
#https://python-packaging.readthedocs.io/en/latest/minimal.html
import os, glob, sys
import os.path
from shutil import copyfile
from setuptools import find_packages
from setuptools import setup

fenrirVersion = '1.9.3'
packageVersion = 'post1'

# handle flags for package manager like yaourt and pacaur.
forceSettings = False
if "--force-settings" in sys.argv:
    forceSettings = True
    sys.argv.remove("--force-settings")

data_files = []
directories = glob.glob('config/*')
for directory in directories:
    files = glob.glob(directory+'/*') 
    destDir = ''
    if 'config/punctuation' in directory :
        destDir = '/etc/fenrirscreenreader/punctuation'
    elif 'config/keyboard' in directory:
        destDir = '/etc/fenrirscreenreader/keyboard'
    elif 'config/settings' in directory:
        destDir = '/etc/fenrirscreenreader/settings'
        if not forceSettings:
            try:
                del(files[files.index('config/settings/settings.conf')])
            except:
                pass
    elif 'config/scripts' in directory:
        destDir = '/usr/share/fenrirscreenreader/scripts' 
    if destDir != '':
        data_files.append((destDir, files))

files = glob.glob('config/sound/default/*')                 
destDir = '/usr/share/sounds/fenrirscreenreader/default'            
data_files.append((destDir, files))
files = glob.glob('config/sound//template/*')                 
destDir = '/usr/share/sounds/fenrirscreenreader/template'
data_files.append((destDir, files))
files = glob.glob('tools/*') 
data_files.append(('/usr/share/fenrirscreenreader/tools', files))
data_files.append(('/usr/share/man/man1', ['docu/fenrir.1']))

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    # Application name:
    name="fenrir-screenreader",
    # Version number:
    version=fenrirVersion + '.' + packageVersion,
    # description
    description="A TTY Screen Reader for Linux.",
    long_description=read('README.md'),
    keywords=['screenreader', 'a11y', 'accessibility', 'terminal', 'TTY', 'console'],        
    license="License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
    url="https://github.com/chrys87/fenrir/",
    download_url = 'https://github.com/chrys87/fenrir/archive/' + fenrirVersion + '.tar.gz',	
    classifiers=[
        "Programming Language :: Python",        
        "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",        
        "Development Status :: 5 - Production/Stable",
        "Topic :: Multimedia :: Sound/Audio :: Speech",
        "Environment :: Console",        
    ],
    
    # Application author details:
    author="Chrys, Storm_dragon, Jeremiah and others",
    author_email="chrysg@linux-a11y.org",

    # Packages
    packages=find_packages('src/'),
    package_dir={'': 'src/'},
    scripts=['src/fenrir','src/fenrir-daemon'],

    # Include additional files into the package
    include_package_data=True,
    zip_safe=False,

    data_files=data_files,
    
    # Dependent packages (distributions)
    install_requires=[
        "evdev",
        "daemonize",
        "dbus-python",
        "pyudev",
        "setuptools",
        "pexpect",
        "pyttsx3",
        "pyte",
    ],
    
)

if not forceSettings:
    print('')
    # create settings file from example if not exist
    if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
        try:
            copyfile('/etc/fenrirscreenreader/settings/settings.conf.example', '/etc/fenrirscreenreader/settings/settings.conf')
            print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
        except:
            pass
    else:
        print('settings.conf file found. It is not overwritten automatical')

print('')
print('To have Fenrir start at boot:')
print('sudo systemctl enable fenrir')
print('Pulseaudio users may want to run:')
print('/usr/share/fenrirscreenreader/tools/configure_pulse.sh')
print('once as their user account and once as root to configure Pulseaudio.')
print('Please install the following packages manually:')
print('- Speech-dispatcher: for the default speech driver')
print('- Espeak: as basic TTS engine')
print('- BrlTTY: for Braille')
print('- sox: is a player for the generic sound driver')