silnrsi / smith

font development, testing and release
Other
14 stars 5 forks source link

smith configure fails under Py3 #54

Closed devosb closed 5 years ago

devosb commented 5 years ago

The py3 branch, running under Python 3, does not configure a project. The output from smith configure is

  File "/home/fontdev/builds/smith3/waflib/Scripting.py", line 154, in waf_entry_point
    run_commands()
  File "/home/fontdev/builds/smith3/waflib/Scripting.py", line 245, in run_commands
    run_command(cmd_name)
  File "/home/fontdev/builds/smith3/waflib/Scripting.py", line 231, in run_command
    ctx.execute()
  File "/home/fontdev/builds/smith3/waflib/Configure.py", line 216, in execute
    super(ConfigurationContext, self).execute()
  File "/home/fontdev/builds/smith3/waflib/Context.py", line 216, in execute
    self.recurse([os.path.dirname(g_module.root_path)], fname=os.path.basename(g_module.root_path))
  File "/home/fontdev/builds/smith3/waflib/Context.py", line 295, in recurse
    self.post_recurse(node)
  File "/home/fontdev/builds/smith3/waflib/Configure.py", line 332, in post_recurse
    self.hash = hash((self.hash, node.read('rb')))
  File "/home/fontdev/builds/smith3/waflib/Node.py", line 159, in read
    return Utils.readf(self.abspath(), flags)
  File "/home/fontdev/builds/smith3/waflib/Utils.py", line 137, in readf
    f = open(fname, m, encoding="utf-8")
ValueError: binary mode doesn't take an encoding argument

Some of the calls to the function readf() in waflib/Utils.py specify a mode of binary, and in Python 3 the open() function does not accept an encoding specification. If a mode of text is specified, then I think the encoding specification is okay.

Since Python 3 open() defaults to utf-8 for an encoding, it does not need to be specified, and commit https://github.com/silnrsi/smith/commit/127a04be2b635cb622a488ffeb898e737f433d85 can be reverted.

devosb commented 5 years ago

Fixed in commit https://github.com/silnrsi/smith/commit/e042a21214c655e670815b59c458d01853ce3941 and https://github.com/silnrsi/smith/commit/512b239a6a4721febcb6419c8605097c21633ee0