forked from isantop/kernelstub
-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup.py
executable file
·89 lines (71 loc) · 2.71 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
#!/usr/bin/python3
"""
Copyright 2017-2018 Ian Santopietro <isantop@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
Portions of test-related code authored by Jason DeRose <jason@system76.com>
"""
from setuptools import setup
from setuptools import Command
import os, subprocess, sys
TREE = os.path.dirname(os.path.abspath(__file__))
DIRS = [
'kernelstub',
'bin']
def run_under_same_interpreter(opname, script, args):
print('\n** running: {}...'.format(script), file=sys.stderr)
if not os.access(script, os.R_OK | os.X_OK):
print('ERROR: cannot read and execute: {!r}'.format(script),
file=sys.stderr
)
print('Consider running `setup.py test --skip-{}`'.format(opname),
file=sys.stderr
)
sys.exit(3)
cmd = [sys.executable, script] + args
print('check_call:', cmd, file=sys.stderr)
subprocess.check_call(cmd)
print('** PASSED: {}\n'.format(script), file=sys.stderr)
def run_pyflakes3():
script = '/usr/bin/pyflakes3'
names = [
'setup.py',
] + DIRS
args = [os.path.join(TREE, name) for name in names]
run_under_same_interpreter('flakes', script, args)
class Test(Command):
description = 'run pyflakes3'
user_options = [
('skip-flakes', None, 'do not run pyflakes static checks'),
]
def initialize_options(self):
self.skip_sphinx = 0
self.skip_flakes = 0
def finalize_options(self):
pass
def run(self):
if not self.skip_flakes:
run_pyflakes3()
setup(name='kernelstub',
version='3.1.4',
description='Automatic kernel efistub manager for UEFI',
url='https://launchpad.net/kernelstub',
author='Ian Santopietro',
author_email='isantop@gmail.com',
license='ISC',
packages=['kernelstub'],
scripts=['bin/kernelstub'],
cmdclass={'test': Test},
data_files=[
('/etc/kernel/postinst.d', ['data/kernel/zz-kernelstub']),
('/etc/initramfs/post-update.d', ['data/initramfs/zz-kernelstub']),
('/etc/default', ['data/config/kernelstub.SAMPLE'])]
)