This fixes "Generated from" comments to not include local source path in generated files.
Unified · Split
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | # License along with mpv. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | # |
| 24 | 24 | |
| 25 | +import os | |
| 25 | 26 | import sys |
| 26 | 27 | |
| 27 | 28 | def file2string(infilename, infile, outfile): |
| @@ -39,6 +40,6 @@ def file2string(infilename, infile, outfile): · 11 unmodified lines | ||
| 39 | 40 | outfile.write('"' + ''.join(conv[c] for c in line) + '"\n') |
| 40 | 41 | |
| 41 | 42 | if __name__ == "__main__": |
| 42 | − outfile = open(sys.argv[2], "w") | |
| 43 | − with open(sys.argv[1], 'rb') as infile: | |
| 44 | − file2string(sys.argv[1], infile, outfile) | |
| 43 | + | |
| 44 | + with open(sys.argv[1], 'rb') as infile, open(sys.argv[2], "w") as outfile: | |
| 45 | + file2string(os.path.relpath(sys.argv[1], sys.argv[3]), infile, outfile) | |
| @@ -1,8 +1,6 @@ | ||
| 1 | −input = join_paths(source_root, 'TOOLS', 'osxbundle', | |
| 2 | − 'mpv.app', 'Contents', 'Resources', 'icon.icns') | |
| 3 | 1 | osxbundle = custom_target('osxbundle', |
| 4 | − input: input, | |
| 2 | + input: join_paths('mpv.app', 'Contents', 'Resources', 'icon.icns'), | |
| 5 | 3 | output: 'icon.icns.inc', |
| 6 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 4 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 7 | 5 | ) |
| 8 | 6 | sources += osxbundle |
| @@ -2,9 +2,9 @@ icons = ['16', '32', '64', '128'] · 1 unmodified line | ||
| 2 | 2 | foreach size: icons |
| 3 | 3 | name = 'mpv-icon-8bit-'+size+'x'+size+'.png' |
| 4 | 4 | icon = custom_target(name, |
| 5 | − input: join_paths(source_root, 'etc', name), | |
| 5 | + input: name, | |
| 6 | 6 | output: name + '.inc', |
| 7 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 7 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 8 | 8 | ) |
| 9 | 9 | sources += icon |
| 10 | 10 | endforeach |
| @@ -12,9 +12,9 @@ endforeach · 1 unmodified line | ||
| 12 | 12 | etc_files = ['input.conf', 'builtin.conf'] |
| 13 | 13 | foreach file: etc_files |
| 14 | 14 | etc_file = custom_target(file, |
| 15 | − input: join_paths(source_root, 'etc', file), | |
| 15 | + input: file, | |
| 16 | 16 | output: file + '.inc', |
| 17 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 17 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 18 | 18 | ) |
| 19 | 19 | sources += etc_file |
| 20 | 20 | endforeach |
| @@ -2,9 +2,9 @@ icons = ['16', '32', '64', '128'] · 1 unmodified line | ||
| 2 | 2 | foreach size: icons |
| 3 | 3 | name = 'mpv-icon-8bit-'+size+'x'+size+'.png' |
| 4 | 4 | icon = custom_target(name, |
| 5 | − input: join_paths(source_root, 'etc', name), | |
| 5 | + input: name, | |
| 6 | 6 | output: name + '.inc', |
| 7 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 7 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 8 | 8 | ) |
| 9 | 9 | sources += icon |
| 10 | 10 | endforeach |
| @@ -12,9 +12,9 @@ endforeach · 1 unmodified line | ||
| 12 | 12 | etc_files = ['input.conf', 'builtin.conf'] |
| 13 | 13 | foreach file: etc_files |
| 14 | 14 | etc_file = custom_target(file, |
| 15 | − input: join_paths(source_root, 'etc', file), | |
| 15 | + input: file, | |
| 16 | 16 | output: file + '.inc', |
| 17 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 17 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 18 | 18 | ) |
| 19 | 19 | sources += etc_file |
| 20 | 20 | endforeach |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | defaults_js = custom_target('defaults.js', |
| 2 | − input: join_paths(source_root, 'player', 'javascript', 'defaults.js'), | |
| 2 | + input: 'defaults.js', | |
| 3 | 3 | output: 'defaults.js.inc', |
| 4 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 4 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 5 | 5 | ) |
| 6 | 6 | sources += defaults_js |
| @@ -3,9 +3,9 @@ lua_files = ['defaults.lua', 'assdraw.lua', 'options.lua', 'osc.lua', · 2 unmodified lines | ||
| 3 | 3 | 'input.lua', 'fzy.lua', 'select.lua'] |
| 4 | 4 | foreach file: lua_files |
| 5 | 5 | lua_file = custom_target(file, |
| 6 | − input: join_paths(source_root, 'player', 'lua', file), | |
| 6 | + input: file, | |
| 7 | 7 | output: file + '.inc', |
| 8 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 8 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 9 | 9 | ) |
| 10 | 10 | sources += lua_file |
| 11 | 11 | endforeach |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | osd_font = custom_target('osd_font.otf', |
| 2 | − input: join_paths(source_root, 'sub', 'osd_font.otf'), | |
| 2 | + input: 'osd_font.otf', | |
| 3 | 3 | output: 'osd_font.otf.inc', |
| 4 | − command: [file2string, '@INPUT@', '@OUTPUT@'], | |
| 4 | + command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'], | |
| 5 | 5 | ) |
| 6 | 6 | sources += osd_font |