diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-11-25 00:24:40 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-11-25 16:29:01 +0000 |
commit | 992a7ee6e7603c2552971dc516ca4e6c45ae2d21 (patch) | |
tree | 1414bd3cc91540812d54b6160516d78685a7275a /tools/asn2wrs.py | |
parent | dde848b3d925d040592bd3f86487e9bc86905550 (diff) |
asn2wrs.py: always use relative paths
Avoids absolute paths when using cmake and doing an in-tree build.
Before (source directory is /tmp/wireshark):
/*--- Included file: /tmp/wireshark/asn1/t38/packet-t38-exp.h ---*/
After:
/*--- Included file: packet-t38-exp.h ---*/
Change-Id: Id5c98bff7b97447479e1a09751701f2f52132b20
Reviewed-on: https://code.wireshark.org/review/12118
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'tools/asn2wrs.py')
-rwxr-xr-x | tools/asn2wrs.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index cbeb49f881..13c5eb29ec 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -585,6 +585,10 @@ def dependency_compute(items, dependency, map_fn = lambda t: t, ignore_fn = lamb x[e] = True return (item_ord, item_cyc) +# Given a filename, return a relative path from the current directory +def relpath(filename): + return os.path.relpath(filename) + # Given a filename, return a relative path from epan/dissectors def rel_dissector_path(filename): path_parts = os.path.abspath(filename).split(os.sep) @@ -2761,7 +2765,7 @@ class EthCnf: if opt in ("-I",): par = self.check_par(par, 1, 1, fn, lineno) if not par: return - self.include_path.append(par[0]) + self.include_path.append(relpath(par[0])) elif opt in ("-b", "BER", "CER", "DER"): par = self.check_par(par, 0, 0, fn, lineno) self.ectx.encoding = 'ber' @@ -2799,11 +2803,11 @@ class EthCnf: elif opt in ("-O",): par = self.check_par(par, 1, 1, fn, lineno) if not par: return - self.ectx.output.outdir = par[0] + self.ectx.output.outdir = relpath(par[0]) elif opt in ("-s",): par = self.check_par(par, 1, 1, fn, lineno) if not par: return - self.ectx.output.single_file = par[0] + self.ectx.output.single_file = relpath(par[0]) elif opt in ("-k",): par = self.check_par(par, 0, 0, fn, lineno) self.ectx.output.keep = True @@ -7933,14 +7937,14 @@ def eth_main(): if o in ("-h", "-?"): eth_usage(); sys.exit(2) if o in ("-c",): - conf_to_read = a + conf_to_read = relpath(a) if o in ("-I",): - ectx.conform.include_path.append(a) + ectx.conform.include_path.append(relpath(a)) if o in ("-E",): ectx.expcnf = True ectx.justexpcnf = True if o in ("-D",): - ectx.srcdir = a + ectx.srcdir = relpath(a) if o in ("-C",): ectx.constraints_check = True if o in ("-X",): |