moreati / cloudabi-ports

Packages for CloudABI
Other
1 stars 0 forks source link

Standardise the representation & manipulation of paths #3

Open moreati opened 8 years ago

moreati commented 8 years ago

In most systems on which python runs a path has the same representation: str or bytes. This representation is an implicit assumption throughout Python - including importlib, sys.path, os.path, sys.prefix, pathlib.

A "path" in CloudABI is either a file descriptor, or a string path relative to a file descriptor. So joining to paths won't reduce to string concatenation.

For importlib._bootstrap*. I've hacked together paths as a mixture of int and (int, str) tuples. This (or something like it) needs to be formalised into a Path object, maybe one based on pathlib.Path. Then the numerous isinstance(...) calls can be removed. The complication is that importlib._bootstrap* executes before pathlib is available.

dckc commented 8 years ago

have you looked at pathlib? I'd like to see integration with that.