-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
scapy.py
55 lines (38 loc) · 1.42 KB
/
scapy.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
from pyqtdeploy import Component, PythonPackage
class scapyComponent(Component):
""" The scapy component. """
def get_archive_name(self):
""" Return the filename of the source archive. """
return 'scapy-{}.tar.gz'.format(self.version)
def get_archive_urls(self):
""" Return the list of URLs where the source archive might be
downloaded from.
"""
return self.get_pypi_urls('scapy')
def verify(self):
""" Verify the component. """
# Make sure any installed version is the one specified.
if not self.install_from_source:
self._verify_installed_version()
def install(self):
""" Install for the target. """
if not self.install_from_source:
self.error("need install from source")
return
else:
self.unpack_archive(self.get_archive())
self.copy_dir('.', os.path.join(self.target_include_dir))
def _verify_installed_version(self):
from scapy import VERSION
if str(self.version) > VERSION:
self.error("Incomplatible version %s < %s" %
(VERSION, self.version))
@property
def provides(self):
""" The dict of parts provided by the component. """
parts = {
'scapy': PythonPackage(
deps=('Python:ctypes', 'Python:ctypes.util'),
),
}
return parts