From 421b1ca6bddb3d4d4c7d868804da1646086590af Mon Sep 17 00:00:00 2001 From: Radoslaw Bogdanowicz <43962167+rbo-ktw@users.noreply.github.com> Date: Mon, 22 Oct 2018 19:42:25 +0200 Subject: [PATCH] Use relative path to scapy layers directory Problem: Scapy-ssl_tls/setup.py copies its layers to: C:\Python27\Lib\site-packages\python27\lib\site-packages\scapy\layers when wheel package is installed. get_layer_files_dst() method returns list of tuples (, []), where is an absolute path. According to distutils documentation it should copy these files where we expect, but it does not work because wheel module does not support absolute paths, and they end up being installed relative to site-packages. Solution: Relative (to sys.prefix) path to scapy installation directory is used now. --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 6458ce0..15d5a9a 100755 --- a/setup.py +++ b/setup.py @@ -71,6 +71,8 @@ def get_layer_files_dst(sites, path="scapy_ssl_tls"): if os.path.isfile(layer_file_path): layer_files.append(layer_file_path) for scapy_location in scapy_locations: + if scapy_location.startswith(sys.prefix): + scapy_location = scapy_location [len(sys.prefix):].lstrip(os.path.sep) data_files.append( (os.path.join(scapy_location, "layers"), layer_files)) return data_files