• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1PIP=`which pip || (python --version 2>&1 | grep -q 'Python 2' && which pip2) || (python --version 2>&1 | grep -q 'Python 3' && which pip3)`
2
3# Install dependencies using pip
4if [ -z "$SCAPY_SUDO" -o "$SCAPY_SUDO" = "false" ]
5then
6  SCAPY_SUDO=""
7  if [ "$TRAVIS_OS_NAME" = "osx" ]
8  then
9    PIP_INSTALL_FLAGS="--user"
10  fi
11else
12  SCAPY_SUDO="$SCAPY_SUDO -H"
13fi
14
15$SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U mock
16
17if python --version 2>&1 | grep -q '^Python 3\.[0123]'
18then
19  # cryptography with Python 3 < 3.4 requires enum34
20  $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U enum34
21fi
22
23if ! python --version 2>&1 | grep -q PyPy; then
24  # cryptography requires PyPy >= 2.6, Travis CI uses 2.5.0
25  $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U cryptography
26fi
27
28# Install coverage
29if [ "$SCAPY_COVERAGE" = "yes" ]
30then
31  $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U coverage
32  $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U PyX
33  $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U codecov
34fi
35
36# Install pcap & dnet
37if [ ! -z $SCAPY_USE_PCAPDNET ]
38then
39  if [ "$TRAVIS_OS_NAME" = "linux" ]
40  then
41    $SCAPY_SUDO apt-get -qy install libdumbnet-dev libpcap-dev
42    # $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U pypcap  ## sr(timeout) HS
43    # $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U pcapy   ## sniff HS
44    # $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U pylibpcap  ## won't install
45    $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U http://http.debian.net/debian/pool/main/p/python-libpcap/python-libpcap_0.6.4.orig.tar.gz
46    $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U pydumbnet
47    # wget https://pypi.python.org/packages/71/60/15b9e0005bf9062bdc04fc8129b4cdb01cc4189a75719441ff2e23e55b15/dnet-real-1.12.tar.gz
48    # tar zxf dnet-real-1.12.tar.gz
49    # cd dnet-real-1.12
50    # sed -i 's/dnet\.h/dumbnet.h/; s/|Py_TPFLAGS_CHECKTYPES//g' dnet.c
51    # sed -i 's#dnet_extobj = \[\]#dnet_extobj = \["/usr/lib/libdumbnet.so"\]#' setup.py
52    # $SCAPY_SUDO $PIP install $PIP_INSTALL_FLAGS -U .
53    # cd ../
54  elif [ "$TRAVIS_OS_NAME" = "osx" ]
55  then
56    mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages
57    echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth
58
59    brew update
60    brew install --with-python libdnet
61    brew install .travis/pylibpcap.rb
62  fi
63fi
64
65# Install wireshark data
66if [ ! -z "$SCAPY_SUDO" ] && [ "$TRAVIS_OS_NAME" = "linux" ]
67then
68  $SCAPY_SUDO apt-get -qy install openssl libwireshark-data
69fi
70