JadyXuan / NTTS

NO TIME TO SLEEP
MIT License
627 stars 25 forks source link

chore: adapt multi-operating system #27

Closed wufei-png closed 1 month ago

wufei-png commented 1 month ago

Luckily I have mac, linux and window computers and tested without problems. some reference: https://stackoverflow.com/a/13874620/24533355 https://stackoverflow.com/questions/4553129/when-to-use-os-name-sys-platform-or-platform-system https://blog.csdn.net/chinaren0001/article/details/8549259

wufei-png commented 1 month ago

@JadyXuan After accept my pr of pip, the file will conflict so I update this pr to newest main branch. Besides I made more description of my commit:

It seems that site.getsitepackages() is enough if python version > 2.7 (in most common cases), here chore: adapt multi-operating system's just a bit of redundant compatibility.

So I also made a python version compatibility in this commit chore: compatible with more python versions to avoid such problems, I think this is necessary because if site doesn't have the getsitepackages() attr, the code will crash without calling sys.platform ,and getsitepackages() return nil seems no possible

JadyXuan commented 1 month ago

Thank you for your contribution to the release and version compatibility of pip. I also believe that it seems impossible to enter the stage of system type judgment based on previous logical judgments. It is necessary to enable Traceback to accurately display flawless information in the scenarios where this package may be used. Thank you again for your rigor.