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