Recursively add files under data_path to data_files list. Recursively add files under data_path to the list of data_files to be installed (and distributed). The data_path can be either a relative path-name, or an absolute path-name, or a 2-tuple where the first argum
(self, data_path)
| 1068 | ' it may be too late to add a subpackage '+ subpackage_name) |
| 1069 | |
| 1070 | def add_data_dir(self, data_path): |
| 1071 | """Recursively add files under data_path to data_files list. |
| 1072 | |
| 1073 | Recursively add files under data_path to the list of data_files to be |
| 1074 | installed (and distributed). The data_path can be either a relative |
| 1075 | path-name, or an absolute path-name, or a 2-tuple where the first |
| 1076 | argument shows where in the install directory the data directory |
| 1077 | should be installed to. |
| 1078 | |
| 1079 | Parameters |
| 1080 | ---------- |
| 1081 | data_path : seq or str |
| 1082 | Argument can be either |
| 1083 | |
| 1084 | * 2-sequence (<datadir suffix>, <path to data directory>) |
| 1085 | * path to data directory where python datadir suffix defaults |
| 1086 | to package dir. |
| 1087 | |
| 1088 | Notes |
| 1089 | ----- |
| 1090 | Rules for installation paths:: |
| 1091 | |
| 1092 | foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar |
| 1093 | (gun, foo/bar) -> parent/gun |
| 1094 | foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b |
| 1095 | (gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun |
| 1096 | (gun/*, foo/*) -> parent/gun/a, parent/gun/b |
| 1097 | /foo/bar -> (bar, /foo/bar) -> parent/bar |
| 1098 | (gun, /foo/bar) -> parent/gun |
| 1099 | (fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar |
| 1100 | |
| 1101 | Examples |
| 1102 | -------- |
| 1103 | For example suppose the source directory contains fun/foo.dat and |
| 1104 | fun/bar/car.dat: |
| 1105 | |
| 1106 | >>> self.add_data_dir('fun') #doctest: +SKIP |
| 1107 | >>> self.add_data_dir(('sun', 'fun')) #doctest: +SKIP |
| 1108 | >>> self.add_data_dir(('gun', '/full/path/to/fun'))#doctest: +SKIP |
| 1109 | |
| 1110 | Will install data-files to the locations:: |
| 1111 | |
| 1112 | <package install directory>/ |
| 1113 | fun/ |
| 1114 | foo.dat |
| 1115 | bar/ |
| 1116 | car.dat |
| 1117 | sun/ |
| 1118 | foo.dat |
| 1119 | bar/ |
| 1120 | car.dat |
| 1121 | gun/ |
| 1122 | foo.dat |
| 1123 | car.dat |
| 1124 | |
| 1125 | """ |
| 1126 | if is_sequence(data_path): |
| 1127 | d, data_path = data_path |
no test coverage detected