Version parsing issue in teensy/PioPlatform?

I was trying out the new platform_packages to point to a custom framework-arduinoteensy (GitHub - aforren1/custom-teensy-pio), with the platformio.ini below:

[env:teensy_custom_device]
platform = teensy
; local works fine, and detects the correct version
;platform_packages = framework-arduinoteensy @ file://C://Users//adf//Documents//teensy//custom-teensy-pio
; remote reports the version as the hash, which then fails
platform_packages = framework-arduinoteensy @ https://github.com/aforren1/custom-teensy-pio.git
board = teensy31
framework = arduino

and ran into this error:

IndexError: list index out of range:
  File "C:\Users\adf\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 156:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250:
    exec _file_ in call_stack[-1].globals
  File "C:\Users\adf\.platformio\platforms\teensy\builder\main.py", line 144:
    target_elf = env.BuildProgram()
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "C:\Users\adf\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "C:\Users\adf\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 118:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "C:\Users\adf\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 330:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 604:
    return method(*args, **kw)
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\adf\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250:
    exec _file_ in call_stack[-1].globals
  File "C:\Users\adf\.platformio\platforms\teensy\builder\frameworks\arduino.py", line 75:
    ("TEENSYDUINO", int(FRAMEWORK_VERSION.split(".")[1])),

During debugging, I looked at the FRAMEWORK_VERSION, which is reported as u'25d9701' (the short hash from the most recent commit on the remote repository), rather than the expected 1.152.0 (bumped to differentiate the default package).

When I point to a local version of the repository (commented out in the platformio.ini above), all works well-- it reports the right version number, compiles, links, etc.

I’m not savvy enough on the internals of PlatformIO or the Teensy build process, but there might be an issue with how get_platform_version detects the package version? Or any pointers on how to structure the framework-arduinoteensy properly?

I’m wondering how that got in there. The line

Should just get the package version from package.json, which is correct

Is there a version conflict? After the file was downloaded in your local hard driver (C:\Users\adf\.platformio\packages\framework-arduinoteensy-XYZ\package.json) does it sitll have the "version":"1.152.0" line?

If you want a quickfix then find this line

in your local platform script (C:\Users\adf\.platformio\platform\teensy\builders\arduino.py) and replace it wth a hardcoded value (I presume 152).

Thanks for the response! I purged the ...\.platformio\packages directory and tried things again.

Starting with the remote package, it does have the right version ("version":"1.152.0") in the package.json, but fails the install (with the same result). As a sanity check, the (FRAMEWORK_DIR, FRAMEWORK_VERSION) is ('C:\\Users\\adf\\.platformio\\packages\\framework-arduinoteensy', u'25d9701').

Removing the incomplete framework_arduinoteensy folder and re-doing with the local file://... succeeds, and reports ('C:\\Users\\adf\\.platformio\\packages\\framework-arduinoteensy', u'1.152.0') for the above (also works fine without removing the previous unsuccessful install-- the remote one gets shuffled to packages\framework-arduinoteensy@src-ffd6...\).

Installing from the local package happens to fit my immediate needs well, but feeding in the hardcoded version also works.