Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
[scons] Python 3 support for SConscripts and related tools
Browse files Browse the repository at this point in the history
SCons 3.0 features support for both Python 3.5+ and Python 2.7.
These changes make all build and tool scripts compatible with
both versions and adapt the CI systems too.
  • Loading branch information
salkinium committed Jan 3, 2018
2 parents efc2171 + 5a38cc0 commit 3b47fa5
Show file tree
Hide file tree
Showing 234 changed files with 524 additions and 505 deletions.
49 changes: 49 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
- checkout
- run:
name: Check environment
command: |
env
locale -a
python --version || true
python2 --version || true
python3 --version || true
Expand All @@ -30,6 +33,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -43,6 +47,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -56,6 +61,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -69,6 +75,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -82,6 +89,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -95,6 +103,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -108,6 +117,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -121,6 +131,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -134,6 +145,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -147,6 +159,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -160,6 +173,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -174,6 +188,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -187,6 +202,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -200,6 +216,7 @@ jobs:
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
Expand All @@ -209,6 +226,36 @@ jobs:
command: |
scons check=devices
"scripts-python2.7":
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
- checkout
- run:
name: Check if tool scripts run with Python2
command: |
python2 tools/authors.py --handles --count --shoutout --since 2017-01-01
python2 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp
"scripts-python3":
docker:
- image: roboterclubaachen/xpcc-build:latest
environment:
- LANG: "en_US.UTF-8"
- SCONS_LIB_DIR: "/usr/local/lib/python2.7/dist-packages/scons-2.5.1"
- SCONSFLAGS: "-j3"
steps:
- checkout
- run:
name: Check if tool scripts run with Python3
command: |
python3 tools/authors.py --handles --count --shoutout --since 2017-01-01
python3 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp
workflows:
version: 2
build:
Expand All @@ -229,3 +276,5 @@ workflows:
- "generic-examples"
- "linux-examples"
- "avr-examples"
- "scripts-python2.7"
- "scripts-python3"
20 changes: 18 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ addons:
- libgtkmm-2.4-dev
- g++-7
- libzmqpp-dev
- texlive-latex-base
- texlive-fonts-recommended

before_install:
- export CC=gcc-7
Expand All @@ -36,8 +38,12 @@ before_install:
- which arm-none-eabi-g++
- arm-none-eabi-g++ --version
- pip install --upgrade pip wheel
- pip install jinja2 lxml
- pip install scons==2.5.1
- pip install jinja2 lxml numpy
- pip install scons
- pip install configparser future
- pip install pyx==0.12.1
- pip3 install wheel
- pip3 install jinja2 lxml numpy scons pyx

cache:
directories:
Expand All @@ -57,3 +63,13 @@ env:
- TEST_SUITE="unittest target=atmega"

script: "scons $TEST_SUITE"

jobs:
include:
- stage: deploy
script:
- "python2 tools/authors.py --handles --count --shoutout --since 2017-01-01"
- "python3 tools/authors.py --handles --count --shoutout --since 2017-01-01"
- "python2 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp"
- "python3 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp"
env: TEST_SUITE=""
8 changes: 4 additions & 4 deletions SConscript.check
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ if check is not None:
if exitStatus != 0:
everythingOk = False

print "\nRESULTS:\n"
print '\n'.join(result)
print("\nRESULTS:\n")
print('\n'.join(result))
if everythingOk:
print "\nOK!"
print("\nOK!")
Exit(0)
else:
print "\nFAIL!"
print("\nFAIL!")
Exit(1)

env.Alias('check', None)
2 changes: 1 addition & 1 deletion SConscript.generate
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for dir in ['tests', 'examples']:

if not parser.getboolean('scons', 'regenerate', True):
if ARGUMENTS.get('verbose') == '1':
print "skip '%s'" % path
print("skip '%s'" % path)
continue

rootpath = os.sep.join(['..' for x in range(len(path.split(os.sep)))])
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/analog_read_serial/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/blink/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/digital_read_serial/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/read_analog_voltage/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/1-wire/ds18b20/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/adc/basic/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/adc/oversample/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/app_can2usb/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/assert/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/can/mcp2515/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/can/mcp2515_uart/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/communication/receiver/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/communication/sender/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/benchmark/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/caged_ball/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/draw/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/image/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/text/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm128/touch/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm132/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/dogm163/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/hd44780/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/display/siemens_s65/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/flash/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/gpio/basic/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/gpio/blinking/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
2 changes: 1 addition & 1 deletion examples/avr/gpio/button_group/SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# path to the xpcc root directory
xpccpath = '../../../..'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
exec(compile(open(xpccpath + '/scons/SConstruct', "rb").read(), xpccpath + '/scons/SConstruct', 'exec'))
Loading

0 comments on commit 3b47fa5

Please sign in to comment.