]> granicus.if.org Git - esp-idf/commitdiff
tools: Make kconfig_new Python3-compatible and enable Python3 in idf.py
authorRoland Dobai <dobai.roland@gmail.com>
Tue, 18 Sep 2018 12:43:23 +0000 (14:43 +0200)
committerRoland Dobai <dobai.roland@gmail.com>
Wed, 19 Sep 2018 06:38:09 +0000 (08:38 +0200)
.gitlab-ci.yml
tools/ci/executable-list.txt
tools/idf.py
tools/kconfig_new/confgen.py
tools/kconfig_new/gen_kconfig_doc.py
tools/kconfig_new/test/test_confserver.py

index 6f6d863d0809371f1ffec04ee6ffc80b6a5f0f15..2a943956f9ce2f1328056bd68017aaa879821e99 100644 (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
index 24e22f4b2ac730014d7bc240db12c0f22b4b3611..89c03a120983d4cd7caa485131e8bdf61a18e3ae 100644 (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
index d68834a45f31c26c467734eefbfaa03e0e23c350..1d2f128ec779af009643b93aa5e1fe3f25ac12fa 100755 (executable)
@@ -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",
index 416c28d8869557bf0cd30e17ff657f92b6d1e96b..0d88b84899f55d962df4ffb9337f7209e4202981 100755 (executable)
@@ -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
index e5e6968f18799bc5d46f045281e975a75b4d4bdf..b43106ff31acbf4ae9ffa95df07a2a84ff10804d 100644 (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
 
index 3ce25158b971fa7f2b09f5bf38bdf293ac76a8d1..222cc4543000fc1f535dc45b61a39555bee0cd33 100755 (executable)
@@ -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()