Properly sort versions in "emsdk list"#508
Conversation
|
Great! Sadly I believe some distros such as Ubuntu stopped shipping distutils. We recently had to remove a use of distutils from emscripten itself for this reason: emscripten-core/emscripten#10943. Perhaps a basic re-implementation would be better here? |
|
Wow that's absurd. I see the possible alternatives, please select one:
|
|
I bet we can write a good enough version of this in 3 or 4 lines of python, no? It doesn't need to handle all the possible cases... we could probably start with something like: |
Split version to integers but avoid exceptions in case there is a
non-numerical character in some version.
Comparison:
Before | After
1.39.9 1.39.16
1.39.8 1.39.15
1.39.7 1.39.14
1.39.6 1.39.13
1.39.5 1.39.12
1.39.4 1.39.11
1.39.3 1.39.10
1.39.2 1.39.9
1.39.16 1.39.8
1.39.15 1.39.7
1.39.14 1.39.6
1.39.13 1.39.5
1.39.12 1.39.4
1.39.11 1.39.3
1.39.10 1.39.2
1.39.1 1.39.1
1.39.0 1.39.0
1.38.48 1.38.48
1.38.47 1.38.47
1.38.46 1.38.46
1.38.45 1.38.45
1.38.44 1.38.44
1.38.43 1.38.43
1.38.42 1.38.42
1.38.41 1.38.41
1.38.40 1.38.40
1.38.39 1.38.39
1.38.38 1.38.38
1.38.37 1.38.37
1.38.36 1.38.36
1.38.35 1.38.35
1.38.34 1.38.34
1.38.33 1.38.33
|
Up, WDYT? |
|
This doesn't handle all possible cases (but at least it doesn't crash) and it should be enough for the versioning used in this project |
|
This looks good to me, wdyt @sbc100 ? |
This uses LooseVersion from distutils, here is the doc:
I believe that this should be available in all possible configurations of python, I checked with python2 & 3 on linux. If not, an easy workaround is to catch
ImportErrorand setLooseVersion=None.