-
Notifications
You must be signed in to change notification settings - Fork 29
/
setup.py
executable file
·104 lines (86 loc) · 2.75 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
#!/usr/bin/python3
# system76-driver: Universal driver for System76 computers
# Copyright (C) 2005-2016 System76, Inc.
#
# This file is part of `system76-driver`.
#
# `system76-driver` is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# `system76-driver` is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with `system76-driver`; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
Install `system76driver`.
"""
import sys
if sys.version_info < (3, 4):
sys.exit('ERROR: `system76driver` requires Python 3.4 or newer')
import os
from os import path
import subprocess
from distutils.core import setup
from distutils.cmd import Command
import system76driver
from system76driver.tests.run import run_tests
SCRIPTS = [
'system76-driver',
'system76-driver-cli',
]
def run_pyflakes3():
pyflakes3 = '/usr/bin/pyflakes3'
if not os.access(pyflakes3, os.R_OK | os.X_OK):
print('WARNING: cannot read and execute: {!r}'.format(pyflakes3))
return
tree = path.dirname(path.abspath(__file__))
names = [
'system76driver',
'setup.py',
'system76-daemon',
] + SCRIPTS
cmd = [pyflakes3] + [path.join(tree, name) for name in names]
print('check_call:', cmd)
subprocess.check_call(cmd)
print('[pyflakes3 checks passed]')
class Test(Command):
description = 'run unit tests and doc tests'
user_options = [
('skip-gtk', None, 'Skip GTK related tests'),
]
def initialize_options(self):
self.skip_gtk = 0
def finalize_options(self):
pass
def run(self):
if not run_tests(self.skip_gtk):
raise SystemExit(2)
run_pyflakes3()
setup(
name='system76driver',
version=system76driver.__version__,
description='hardware-specific enhancements for System76 products',
url='https://launchpad.net/system76-driver',
author='System76, Inc.',
author_email='dev@system76.com',
license='GPLv2+',
cmdclass={'test': Test},
packages=[
'system76driver',
'system76driver.tests'
],
scripts=SCRIPTS,
package_data={
'system76driver': ['data/*'],
},
data_files=[
('share/applications', ['system76-driver.desktop']),
('share/icons/hicolor/scalable/apps', ['system76-driver.svg']),
],
)