invoke from build.rs

This commit is contained in:
Dustin Carlino 2018-12-12 16:58:46 -08:00
parent 13134a091b
commit 90fffe2410
2 changed files with 11 additions and 2 deletions

9
editor/build.rs Normal file
View File

@ -0,0 +1,9 @@
use std::process::Command;
fn main() {
assert!(Command::new("/usr/bin/python2")
.args(&["extract_colorscheme.py"])
.status()
.unwrap()
.success());
}

View File

@ -5,14 +5,14 @@ import os
def run():
mapping = {}
for path, _, files in os.walk('.'):
for path, _, files in os.walk('src'):
for f in files:
if f.endswith('.rs') and f != 'colors.rs':
for k, v in read_file(os.path.join(path, f)):
# TODO Check for double-definitions
mapping[k] = v
with open('init_colors.rs', 'w') as f:
with open('src/init_colors.rs', 'w') as f:
f.write('// AUTOGENERATED! Do not modify.\n')
f.write('\n')
f.write('use ezgui::Color;\n')