tools: Make kconfig_new Python3-compatible and enable Python3 in idf.py

This commit is contained in:
Roland Dobai 2018-09-18 14:43:23 +02:00
parent 91f7a9a9e7
commit 173e6aab3e
6 changed files with 12 additions and 9 deletions

View file

@ -389,7 +389,7 @@ test_confserver:
<<: *host_test_template
script:
- cd tools/kconfig_new/test
- ./test_confserver.py
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ./test_confserver.py
test_build_system:
<<: *host_test_template

View file

@ -43,9 +43,6 @@ tools/kconfig/lxdialog/check-lxdialog.sh
tools/kconfig/mconf
tools/kconfig/merge_config.sh
tools/kconfig/streamline_config.pl
tools/kconfig_new/confgen.py
tools/kconfig_new/confserver.py
tools/kconfig_new/test/test_confserver.py
tools/mass_mfg/mfg_gen.py
tools/test_idf_monitor/run_test_idf_monitor.py
tools/unit-test-app/unit_test.py

View file

@ -430,7 +430,9 @@ def get_default_serial_port():
def main():
if sys.version_info[0] != 2 or sys.version_info[1] != 7:
raise FatalError("ESP-IDF currently only supports Python 2.7, and this is Python %d.%d.%d. Search for 'Setting the Python Interpreter' in the ESP-IDF docs for some tips to handle this." % sys.version_info[:3])
print("Note: You are using Python %d.%d.%d. Python 3 support is new, please report any problems "
"you encounter. Search for 'Setting the Python Interpreter' in the ESP-IDF docs if you want to use "
"Python 2.7." % sys.version_info[:3])
parser = argparse.ArgumentParser(description='ESP-IDF build management tool')
parser.add_argument('-p', '--port', help="Serial port",

View file

@ -20,6 +20,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import argparse
import sys
import os

View file

@ -20,6 +20,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import os
import kconfiglib

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import threading
@ -6,6 +7,7 @@ import time
import json
import argparse
import shutil
import tempfile
import pexpect
@ -45,10 +47,10 @@ def main():
parser.add_argument('--logfile', type=argparse.FileType('w'), help='Optional session log of the interactions with confserver.py')
args = parser.parse_args()
# set up temporary file to use as sdkconfig copy
temp_sdkconfig_path = os.tmpnam()
try:
with open(temp_sdkconfig_path, "w") as temp_sdkconfig:
# set up temporary file to use as sdkconfig copy
with tempfile.NamedTemporaryFile(mode="w", delete=False) as temp_sdkconfig:
temp_sdkconfig_path = os.path.join(tempfile.gettempdir(), temp_sdkconfig.name)
with open("sdkconfig") as orig:
temp_sdkconfig.write(orig.read())
@ -61,7 +63,7 @@ def main():
def expect_json():
# run p.expect() to expect a json object back, and return it as parsed JSON
p.expect("{.+}\r\n")
return json.loads(p.match.group(0).strip())
return json.loads(p.match.group(0).strip().decode())
p.expect("Server running.+\r\n")
initial = expect_json()