History

meson: use relative file paths for file2string

This fixes "Generated from" comments to not include local source path in generated files.

Kacper Michajłow committed 2 years ago

Commit 71f22201 parent ff479267 files · +20 −21Browse files

Unified · Split

7 files
  1. TOOLS/file2string.py +4 −3
  2. TOOLS/osxbundle/meson.build +2 −4
  3. etc/meson.build +4 −4
  4. input/meson.build +4 −4
  5. player/javascript/meson.build +2 −2
  6. player/lua/meson.build +2 −2
  7. sub/meson.build +2 −2
TOOLS/file2string.py+4−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 # License along with mpv. If not, see <http://www.gnu.org/licenses/>.
2323 #
2424
25+import os
2526 import sys
2627
2728 def file2string(infilename, infile, outfile):
@@ -39,6 +40,6 @@ def file2string(infilename, infile, outfile): · 11 unmodified lines
3940 outfile.write('"' + ''.join(conv[c] for c in line) + '"\n')
4041
4142 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)
TOOLS/osxbundle/meson.build+2−4
@@ -1,8 +1,6 @@
1−input = join_paths(source_root, 'TOOLS', 'osxbundle',
2− 'mpv.app', 'Contents', 'Resources', 'icon.icns')
31 osxbundle = custom_target('osxbundle',
4− input: input,
2+ input: join_paths('mpv.app', 'Contents', 'Resources', 'icon.icns'),
53 output: 'icon.icns.inc',
6− command: [file2string, '@INPUT@', '@OUTPUT@'],
4+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
75 )
86 sources += osxbundle
etc/meson.build+4−4
@@ -2,9 +2,9 @@ icons = ['16', '32', '64', '128'] · 1 unmodified line
22 foreach size: icons
33 name = 'mpv-icon-8bit-'+size+'x'+size+'.png'
44 icon = custom_target(name,
5− input: join_paths(source_root, 'etc', name),
5+ input: name,
66 output: name + '.inc',
7− command: [file2string, '@INPUT@', '@OUTPUT@'],
7+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
88 )
99 sources += icon
1010 endforeach
@@ -12,9 +12,9 @@ endforeach · 1 unmodified line
1212 etc_files = ['input.conf', 'builtin.conf']
1313 foreach file: etc_files
1414 etc_file = custom_target(file,
15− input: join_paths(source_root, 'etc', file),
15+ input: file,
1616 output: file + '.inc',
17− command: [file2string, '@INPUT@', '@OUTPUT@'],
17+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
1818 )
1919 sources += etc_file
2020 endforeach
input/meson.build+4−4
@@ -2,9 +2,9 @@ icons = ['16', '32', '64', '128'] · 1 unmodified line
22 foreach size: icons
33 name = 'mpv-icon-8bit-'+size+'x'+size+'.png'
44 icon = custom_target(name,
5− input: join_paths(source_root, 'etc', name),
5+ input: name,
66 output: name + '.inc',
7− command: [file2string, '@INPUT@', '@OUTPUT@'],
7+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
88 )
99 sources += icon
1010 endforeach
@@ -12,9 +12,9 @@ endforeach · 1 unmodified line
1212 etc_files = ['input.conf', 'builtin.conf']
1313 foreach file: etc_files
1414 etc_file = custom_target(file,
15− input: join_paths(source_root, 'etc', file),
15+ input: file,
1616 output: file + '.inc',
17− command: [file2string, '@INPUT@', '@OUTPUT@'],
17+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
1818 )
1919 sources += etc_file
2020 endforeach
player/javascript/meson.build+2−2
@@ -1,6 +1,6 @@
11 defaults_js = custom_target('defaults.js',
2− input: join_paths(source_root, 'player', 'javascript', 'defaults.js'),
2+ input: 'defaults.js',
33 output: 'defaults.js.inc',
4− command: [file2string, '@INPUT@', '@OUTPUT@'],
4+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
55 )
66 sources += defaults_js
player/lua/meson.build+2−2
@@ -3,9 +3,9 @@ lua_files = ['defaults.lua', 'assdraw.lua', 'options.lua', 'osc.lua', · 2 unmodified lines
33 'input.lua', 'fzy.lua', 'select.lua']
44 foreach file: lua_files
55 lua_file = custom_target(file,
6− input: join_paths(source_root, 'player', 'lua', file),
6+ input: file,
77 output: file + '.inc',
8− command: [file2string, '@INPUT@', '@OUTPUT@'],
8+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
99 )
1010 sources += lua_file
1111 endforeach
sub/meson.build+2−2
@@ -1,6 +1,6 @@
11 osd_font = custom_target('osd_font.otf',
2− input: join_paths(source_root, 'sub', 'osd_font.otf'),
2+ input: 'osd_font.otf',
33 output: 'osd_font.otf.inc',
4− command: [file2string, '@INPUT@', '@OUTPUT@'],
4+ command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
55 )
66 sources += osd_font

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t