Move the 'meta' dir to 'lib/cretonne/meta'.

The 'lib/cretonne' directory will be the new root of a stand-alone
cretonne crate containg both Python and Rust sources.

This is in preparation for publishing crates on crates.io.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-17 14:16:43 -07:00
parent 8480879f3e
commit e7f30a40b4
37 changed files with 12 additions and 10 deletions

View File

@@ -0,0 +1,36 @@
"""
Generate build dependencies for Cargo.
The `build.py` script is invoked by cargo when building libcretonne to
generate Rust code from the instruction descriptions. Cargo needs to know when
it is necessary to rerun the build script.
If the build script outputs lines of the form:
cargo:rerun-if-changed=/path/to/file
cargo will rerun the build script when those files have changed since the last
build.
"""
from __future__ import absolute_import, print_function
import os
from os.path import dirname, abspath, join
def source_files(top):
"""
Recursively find all interesting source files and directories in the
directory tree starting at top. Yield a path to each file.
"""
for (dirpath, dirnames, filenames) in os.walk(top):
yield dirpath
for f in filenames:
if f.endswith('.py'):
yield join(dirpath, f)
def generate():
print("Dependencies from meta language directory:")
meta = dirname(abspath(__file__))
for path in source_files(meta):
print("cargo:rerun-if-changed=" + path)