Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27720] Android: Error building SDK if python 3 is installed

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2020-01-30T21:07:32.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.0.0
ComponentsAndroid
Labelsandroid, build, gradle, python, sdk
ReporterMichael Gangolf
AssigneeJoshua Quick
Created2019-12-28T11:28:41.000+0000
Updated2020-01-30T21:07:32.000+0000

Description

Using Fedora 31 (Linux) to compile the latest (2019-12-28) git SDK code you will run into problems
Running Titanium "prebuild.js" script.
Error: Command failed: python "titanium_mobile/android/runtime/v8/tools/genBootstrap.py" --runtime=v8
Traceback (most recent call last):
  File "titanium_mobile/android/runtime/v8/tools/genBootstrap.py", line 92, in <module>
    main()
  File "titanium_mobile/android/runtime/v8/tools/genBootstrap.py", line 80, in main
    b = bootstrap.Bootstrap(bindings, moduleId="titanium", moduleName="Titanium")
  File "titanium_mobile/android/runtime/v8/tools/bootstrap.py", line 93, in __init__
    self.addToInitTable(proxy)
  File "titanium_mobile/android/runtime/v8/tools/bootstrap.py", line 120, in addToInitTable
    namespaces.insert(0, moduleNs)
AttributeError: 'map' object has no attribute 'insert'
at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'python "titanium_mobile/android/runtime/v8/tools/genBootstrap.py" --runtime=v8',
  stdout: '',
  stderr: 'Traceback (most recent call last):\n' +
    '  File "titanium_mobile/android/runtime/v8/tools/genBootstrap.py", line 92, in <module>\n' +
    '    main()\n' +
    '  File "titanium_mobile/android/runtime/v8/tools/genBootstrap.py", line 80, in main\n' +
    '    b = bootstrap.Bootstrap(bindings, moduleId="titanium", moduleName="Titanium")\n' +
    '  File "titanium_mobile/android/runtime/v8/tools/bootstrap.py", line 93, in __init__\n' +
    '    self.addToInitTable(proxy)\n' +
    '  File "titanium_mobile/android/runtime/v8/tools/bootstrap.py", line 120, in addToInitTable\n' +
    '    namespaces.insert(0, moduleNs)\n' +
    "AttributeError: 'map' object has no attribute 'insert'\n"
since it is using "python" to run genBootstrap.py. But in Fedora it will use python 3 since that is mapped as a default python. Changing https://github.com/appcelerator/titanium_mobile/blob/f687e3bbf8266707e6e5fdfdba6580e141a2221b/android/titanium/prebuild.js#L111 and https://github.com/appcelerator/titanium_mobile/blob/f687e3bbf8266707e6e5fdfdba6580e141a2221b/android/titanium/prebuild.js#L141 to python2 fixed the issue. A better solution to either port it to python3 or check for the correct python version at the beginning would be better. Python 2 won't be supported after April 2020 (last version was released 19th October) *Recommended Solution:* Use "python2" command line tool if available on system before using "python" command. *Best Solution:* Remove python dependency via ticket: [TIMOB-27719] We'll need to do this in the near future since Apple will no longer pre-install python on future macOS versions.

Comments

  1. Joshua Quick 2020-01-17

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11438
  2. Michael Gangolf 2020-01-17

    PR works fine on my Fedora machine (y)
  3. Samir Mohammed 2020-01-21

    FR passed, Waiting on Jenkins build.
  4. Christopher Williams 2020-01-23

    merged to master for 9.0.0
  5. Lokesh Choudhary 2020-01-30

    Verified the fix with SDK 9.0.0.v20200130075800. Closing.

JSON Source