Strip off leading dots and slash so the generated files are the same regardless
of whether you configure in the checkout directory or build.
If anyone configures in a different directory, we might want a cleaner
approach using os.path.*(). Hopefully this is good enough.
-/* File automatically generated by ./Parser/asdl_c.py */
+/* File automatically generated by Parser/asdl_c.py */
#include "asdl.h"
v.emit("", 0)
def main(srcfile):
- auto_gen_msg = '/* File automatically generated by %s */\n' % sys.argv[0]
+ argv0 = sys.argv[0]
+ index = argv0.find('/')
+ if index > 0:
+ argv0 = argv0[index + 1:]
+ auto_gen_msg = '/* File automatically generated by %s */\n' % argv0
mod = asdl.parse(srcfile)
if not asdl.check(mod):
sys.exit(1)
-/* File automatically generated by ./Parser/asdl_c.py */
+/* File automatically generated by Parser/asdl_c.py */
#include "Python.h"
#include "Python-ast.h"