mjansson / foundation_lib

Cross-platform public domain foundation library in C providing basic support data types and functions to write applications and games in a platform-independent fashion.
The Unlicense
296 stars 24 forks source link

Python3 compatibility #18

Closed pbtrung closed 6 years ago

pbtrung commented 6 years ago

When using python3 to generate ninja build script on develop branch, I got:

foundation_lib (git)-[develop] % python configure.py -t linux --host linux -c deploy

Traceback (most recent call last):
  File "configure.py", line 26, in <module>
    foundation_lib = generator.lib(module = 'foundation', sources = foundation_sources + extrasources)
  File "build/ninja/generator.py", line 119, in lib
    return self.toolchain.lib(self.writer, module, sources, libname, basepath, configs, includepaths, variables)
  File "build/ninja/toolchain.py", line 447, in lib
    return self.build_sources(writer, 'lib', 'multilib', module, sources, libfile, basepath, outpath, configs, includepaths, None, None, None, None, variables, None)
  File "build/ninja/toolchain.py", line 406, in build_sources
    buildpath = os.path.join('$buildpath', config, arch)
  File "/usr/lib/python3.6/posixpath.py", line 92, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 151, in _check_arg_types
    raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components

Arch Linux x64 Python 3.6

Thanks.

mjansson commented 6 years ago

Cheers, should be fixed in 6c2129f4

pbtrung commented 6 years ago

Now version.c is not generated correctly using python 3.

return version_make(0, 0, 1, 0, 0x0);

instead of

return version_make(1, 6, 0, 51, 0x6c2129f); with python 2.

Thanks.

mjansson commented 6 years ago

Updated version generator with similar fix

pbtrung commented 6 years ago

What I got today:

python configure.py -t linux --host linux -c deploy

Traceback (most recent call last):
  File "configure.py", line 26, in <module>
    foundation_lib = generator.lib(module = 'foundation', sources = foundation_sources + extrasources)
  File "build/ninja/generator.py", line 119, in lib
    return self.toolchain.lib(self.writer, module, sources, libname, basepath, configs, includepaths, variables)
  File "build/ninja/toolchain.py", line 447, in lib
    return self.build_sources(writer, 'lib', 'multilib', module, sources, libfile, basepath, outpath, configs, includepaths, None, None, None, None, variables, None)
  File "build/ninja/toolchain.py", line 406, in build_sources
    buildpath = os.path.join('$buildpath', config, arch)
  File "/usr/lib/python3.6/posixpath.py", line 92, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 151, in _check_arg_types
    raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components
mjansson commented 6 years ago

The fix was lost in another update, sorry about that. Restored it now.

pbtrung commented 6 years ago

Working now. Thanks.