jkent / frogfs

Fast Read-Only General-purpose File System (ESP-IDF and ESP8266_RTOS_SDK compatible)
https://frogfs.readthedocs.io
Mozilla Public License 2.0
25 stars 32 forks source link

support python 3.8? #47

Closed phatpaul closed 1 year ago

phatpaul commented 1 year ago

preprocess.py:49 gives error: AttributeError: 'str' object has no attribute 'removeprefix' Looks like this was added in python 3.9, but I have 3.8.

Since 3.8 is supported in IDF 5.1, I think it should be supported here too.

jkent commented 1 year ago

fixed in 9a3dffb

phatpaul commented 1 year ago

Thanks. It's a shame that the fix reduces the readability of the code. The first line is self-documenting, the second, not so much.

-  name, _ = os.path.splitext(file.removeprefix('transform-'))
+  name, _ = os.path.splitext(file[10:])

I'm curious if python has something like poly-fills (like in javascript) to prevent having to reduce the code quality to support older VM versions?

jkent commented 1 year ago

Yeah, "monkey patching" is what they call it in Python. Because there is the startswith(...) lines that guard it, I'm okay with the less than elegant solution.