Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit a356695

Browse files
authored
Merge pull request #610 from openweave/feature/happy_py3_support
Upgrade the happy tests with python3 support
2 parents 5a0eb55 + e73d7a3 commit a356695

File tree

256 files changed

+2282
-1785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+2282
-1785
lines changed

.travis/before_install.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ installdeps()
5858
sudo apt-get update
5959
sudo apt-get -y install bridge-utils
6060
sudo apt-get -y install lcov
61-
sudo apt-get -y install python-lockfile
62-
sudo apt-get -y install python-psutil
63-
sudo apt-get -y install python-setuptools
64-
sudo apt-get -y install swig
65-
61+
sudo apt-get -y install python3-lockfile
62+
sudo apt-get -y install python3-pip
63+
sudo apt-get -y install python3-setuptools
64+
sudo apt-get -y install python3-psutil
6665
;;
6766

6867
openssl-deps)
@@ -161,11 +160,10 @@ case "${BUILD_TARGET}" in
161160
installdeps "happy-deps"
162161

163162
cd $HOME
164-
git clone https://github.com/openweave/happy.git
163+
git clone --single-branch --branch feature/happy_py3_support https://github.com/openweave/happy.git
165164
cd ${HOME}/happy
166165
make install
167-
python pip_packages.py
168-
pip install pexpect
166+
python3 pip_packages.py
169167
sudo apt install python-gobject
170168
sudo apt install python-dbus
171169

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ esac
316316

317317
# Check for Python
318318

319-
AM_PATH_PYTHON
319+
AM_PATH_PYTHON([3.5])
320320

321321
# If a Python interpreter of any color cannot be found, error out.
322322

@@ -836,7 +836,7 @@ else
836836
fi
837837
fi
838838
if test "${with_happy}" != "no"; then
839-
PYTHONPATH=${happy_path}:${PYTHONPATH} python -c 'import happy' 2> /dev/null
839+
PYTHONPATH=${happy_path}:${PYTHONPATH} ${PYTHON} -c 'import happy' 2> /dev/null
840840
if test $? != 0; then
841841
if test "${with_happy}" = "yes"; then
842842
if test -z ${happy_path}; then
@@ -855,7 +855,7 @@ if test "${with_happy}" != "no"; then
855855
fi
856856
if test "${with_happy}" = "yes"; then
857857
HAPPY_MINIMUM_VERSION="1.1.36"
858-
happy_version=`PYTHONPATH=${happy_path}:${PYTHONPATH} ${PYTHON} -c 'import happy; print happy.__version__ if "__version__" in dir(happy) else "0.0.0"'`
858+
happy_version=`PYTHONPATH=${happy_path}:${PYTHONPATH} ${PYTHON} -c 'import happy; print(happy.__version__) if "__version__" in dir(happy) else "0.0.0"'`
859859
AX_COMPARE_VERSION([${HAPPY_MINIMUM_VERSION}],[gt],[${happy_version}],[AC_MSG_ERROR(["The Nest Labs network functional test framework (Happy) is installed with version ${happy_version}; however, Weave test apps require at least version ${HAPPY_MINIMUM_VERSION}."])],[])
860860
fi
861861
AC_MSG_RESULT(${with_happy})

doc/guides/cross-network-inet-multicast-howto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ While it is not particularly important where you clone and build the `mcproxy` d
2020

2121
```
2222
% git clone https://github.com/openweave/happy.git happy
23-
% sudo apt-get install bridge-utils python-lockfile python-psutil python-setuptools
23+
% sudo apt-get install bridge-utils python3-lockfile python3-pip python3-psutil python3-setuptools
2424
% cd happy
2525
% sudo make install
2626
```

src/test-apps/happy/bin/set_test_path.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
#
44
# Copyright (c) 2017 Nest Labs, Inc.
@@ -18,6 +18,7 @@
1818
#
1919

2020

21+
from __future__ import absolute_import
2122
import os
2223
import sys
2324

src/test-apps/happy/bin/weave-bdx.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33

44
#
@@ -25,6 +25,8 @@
2525
# The command is executed by instantiating and running WeaveBDX class.
2626
#
2727

28+
from __future__ import absolute_import
29+
from __future__ import print_function
2830
import getopt
2931
import sys
3032
import set_test_path
@@ -41,13 +43,13 @@
4143
"download=", "offset=", "length=", "tap=", "server-version=", "client-version="])
4244

4345
except getopt.GetoptError as err:
44-
print WeaveBDX.WeaveBDX.__doc__
45-
print hred(str(err))
46+
print(WeaveBDX.WeaveBDX.__doc__)
47+
print(hred(str(err)))
4648
sys.exit(hred("%s: Failed destination parse arguments." % (__file__)))
4749

4850
for o, a in opts:
4951
if o in ("-h", "--help"):
50-
print WeaveBDX.WeaveBDX.__doc__
52+
print(WeaveBDX.WeaveBDX.__doc__)
5153
sys.exit(0)
5254

5355
elif o in ("-q", "--quiet"):

src/test-apps/happy/bin/weave-connection-tunnel.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33

44
#
@@ -25,6 +25,8 @@
2525
# The command is executed by instantiating and running WeaveConnectionTunnel class.
2626
#
2727

28+
from __future__ import absolute_import
29+
from __future__ import print_function
2830
import getopt
2931
import sys
3032
import set_test_path
@@ -40,13 +42,13 @@
4042
["help", "agent=", "source=", "destination=", "quiet", "tap="])
4143

4244
except getopt.GetoptError as err:
43-
print WeaveConnectionTunnel.WeaveConnectionTunnel.__doc__
44-
print hred(str(err))
45+
print(WeaveConnectionTunnel.WeaveConnectionTunnel.__doc__)
46+
print(hred(str(err)))
4547
sys.exit(hred("%s: Failed to parse arguments." % (__file__)))
4648

4749
for o, a in opts:
4850
if o in ("-h", "--help"):
49-
print WeaveConnectionTunnel.WeaveConnectionTunnel.__doc__
51+
print(WeaveConnectionTunnel.WeaveConnectionTunnel.__doc__)
5052
sys.exit(0)
5153

5254
elif o in ("-q", "--quiet"):

src/test-apps/happy/bin/weave-device-description.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33

44
#
@@ -25,6 +25,8 @@
2525
# The command is executed by instantiating and running WeaveDeviceDescription class.
2626
#
2727

28+
from __future__ import absolute_import
29+
from __future__ import print_function
2830
import getopt
2931
import sys
3032
import set_test_path
@@ -41,13 +43,13 @@
4143
["help", "quiet", "server=", "client=", "tap="])
4244

4345
except getopt.GetoptError as err:
44-
print WeaveDeviceDescription.WeaveDeviceDescription.__doc__
45-
print hred(str(err))
46+
print(WeaveDeviceDescription.WeaveDeviceDescription.__doc__)
47+
print(hred(str(err)))
4648
sys.exit(hred("%s: Failed destination parse arguments." % (__file__)))
4749

4850
for o, a in opts:
4951
if o in ("-h", "--help"):
50-
print WeaveDeviceDescription.WeaveDeviceDescription.__doc__
52+
print(WeaveDeviceDescription.WeaveDeviceDescription.__doc__)
5153
sys.exit(0)
5254

5355
elif o in ("-q", "--quiet"):

src/test-apps/happy/bin/weave-fabric-add.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
#
44
# Copyright (c) 2015-2017 Nest Labs, Inc.
@@ -24,6 +24,8 @@
2424
# The command is executed by instantiating and running WeaveFabricAdd class.
2525
#
2626

27+
from __future__ import absolute_import
28+
from __future__ import print_function
2729
import getopt
2830
import sys
2931
import set_test_path
@@ -39,13 +41,13 @@
3941
["help", "id=", "quiet"])
4042

4143
except getopt.GetoptError as err:
42-
print WeaveFabricAdd.WeaveFabricAdd.__doc__
43-
print hred(str(err))
44+
print(WeaveFabricAdd.WeaveFabricAdd.__doc__)
45+
print(hred(str(err)))
4446
sys.exit(hred("%s: Failed to parse arguments." % (__file__)))
4547

4648
for o, a in opts:
4749
if o in ("-h", "--help"):
48-
print WeaveFabricAdd.WeaveFabricAdd.__doc__
50+
print(WeaveFabricAdd.WeaveFabricAdd.__doc__)
4951
sys.exit(0)
5052

5153
elif o in ("-q", "--quiet"):

src/test-apps/happy/bin/weave-fabric-delete.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
#
44
# Copyright (c) 2015-2017 Nest Labs, Inc.
@@ -24,6 +24,8 @@
2424
# The command is executed by instantiating and running WeaveFabricDelete class.
2525
#
2626

27+
from __future__ import absolute_import
28+
from __future__ import print_function
2729
import getopt
2830
import sys
2931
import set_test_path
@@ -39,13 +41,13 @@
3941
["help", "id=", "quiet"])
4042

4143
except getopt.GetoptError as err:
42-
print WeaveFabricDelete.WeaveFabricDelete.__doc__
43-
print hred(str(err))
44+
print(WeaveFabricDelete.WeaveFabricDelete.__doc__)
45+
print(hred(str(err)))
4446
sys.exit(hred("%s: Failed to parse arguments." % (__file__)))
4547

4648
for o, a in opts:
4749
if o in ("-h", "--help"):
48-
print WeaveFabricDelete.WeaveFabricDelete.__doc__
50+
print(WeaveFabricDelete.WeaveFabricDelete.__doc__)
4951
sys.exit(0)
5052

5153
elif o in ("-q", "--quiet"):

src/test-apps/happy/bin/weave-heartbeat.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33

44
#
@@ -25,6 +25,8 @@
2525
# The command is executed by instantiating and running WeaveHeartbeat class.
2626
#
2727

28+
from __future__ import absolute_import
29+
from __future__ import print_function
2830
import getopt
2931
import sys
3032
import set_test_path
@@ -40,13 +42,13 @@
4042
["help", "origin=", "server=",
4143
"count=", "quiet", "tap="])
4244
except getopt.GetoptError as err:
43-
print WeaveHeartbeat.WeaveHeartbeat.__doc__
44-
print hred(str(err))
45+
print(WeaveHeartbeat.WeaveHeartbeat.__doc__)
46+
print(hred(str(err)))
4547
sys.exit(hred("%s: Failed server parse arguments." % (__file__)))
4648

4749
for o, a in opts:
4850
if o in ("-h", "--help"):
49-
print WeaveHeartbeat.WeaveHeartbeat.__doc__
51+
print(WeaveHeartbeat.WeaveHeartbeat.__doc__)
5052
sys.exit(0)
5153

5254
elif o in ("-q", "--quiet"):

0 commit comments

Comments
 (0)