Make autogen.py compatible with Python 3.5 and 2.7 (seemed to be using 3.6-only features?).
@@ -375,7 +375,7 @@ def generate(sources_dir):
# Arguments
sources_dir: Where to put the markdown files.
"""
- template_dir = os.path.join(keras_dir, 'docs', 'templates')
+ template_dir = os.path.join(str(keras_dir), 'docs', 'templates')
if K.backend() != 'tensorflow':
raise RuntimeError('The documentation must be built '
@@ -389,7 +389,7 @@ def generate(sources_dir):
print('Populating sources directory with templates.')
shutil.copytree(template_dir, sources_dir)
- readme = read_file(os.path.join(keras_dir, 'README.md'))
+ readme = read_file(os.path.join(str(keras_dir), 'README.md'))
index = read_file(os.path.join(template_dir, 'index.md'))
index = index.replace('{{autogenerated}}', readme[readme.find('##'):])
with open(os.path.join(sources_dir, 'index.md'), 'w') as f:
@@ -461,11 +461,11 @@ def generate(sources_dir):
with open(path, 'w') as f:
f.write(mkdown)
- shutil.copyfile(os.path.join(keras_dir, 'CONTRIBUTING.md'),
- os.path.join(sources_dir, 'contributing.md'))
- copy_examples(os.path.join(keras_dir, 'examples'),
- os.path.join(sources_dir, 'examples'))
+ shutil.copyfile(os.path.join(str(keras_dir), 'CONTRIBUTING.md'),
+ os.path.join(str(sources_dir), 'contributing.md'))
+ copy_examples(os.path.join(str(keras_dir), 'examples'),
+ os.path.join(str(sources_dir), 'examples'))
if __name__ == '__main__':
- generate(os.path.join(keras_dir, 'docs', 'sources'))
+ generate(os.path.join(str(keras_dir), 'docs', 'sources'))
