MCPcopy Create free account
hub / github.com/numpy/numpy / add_data_files

Method add_data_files

numpy/distutils/misc_util.py:1200–1349  ·  view source on GitHub ↗

Add data files to configuration data_files. Parameters ---------- files : sequence Argument(s) can be either * 2-sequence ( , ) * paths to data files where python datadir prefix defaults

(self,*files)

Source from the content-addressed store, hash-verified

1198 self.data_files[:] = [(p, list(files)) for p, files in data_dict.items()]
1199
1200 def add_data_files(self,*files):
1201 """Add data files to configuration data_files.
1202
1203 Parameters
1204 ----------
1205 files : sequence
1206 Argument(s) can be either
1207
1208 * 2-sequence (<datadir prefix>,<path to data file(s)>)
1209 * paths to data files where python datadir prefix defaults
1210 to package dir.
1211
1212 Notes
1213 -----
1214 The form of each element of the files sequence is very flexible
1215 allowing many combinations of where to get the files from the package
1216 and where they should ultimately be installed on the system. The most
1217 basic usage is for an element of the files argument sequence to be a
1218 simple filename. This will cause that file from the local path to be
1219 installed to the installation path of the self.name package (package
1220 path). The file argument can also be a relative path in which case the
1221 entire relative path will be installed into the package directory.
1222 Finally, the file can be an absolute path name in which case the file
1223 will be found at the absolute path name but installed to the package
1224 path.
1225
1226 This basic behavior can be augmented by passing a 2-tuple in as the
1227 file argument. The first element of the tuple should specify the
1228 relative path (under the package install directory) where the
1229 remaining sequence of files should be installed to (it has nothing to
1230 do with the file-names in the source distribution). The second element
1231 of the tuple is the sequence of files that should be installed. The
1232 files in this sequence can be filenames, relative paths, or absolute
1233 paths. For absolute paths the file will be installed in the top-level
1234 package installation directory (regardless of the first argument).
1235 Filenames and relative path names will be installed in the package
1236 install directory under the path name given as the first element of
1237 the tuple.
1238
1239 Rules for installation paths:
1240
1241 #. file.txt -> (., file.txt)-> parent/file.txt
1242 #. foo/file.txt -> (foo, foo/file.txt) -> parent/foo/file.txt
1243 #. /foo/bar/file.txt -> (., /foo/bar/file.txt) -> parent/file.txt
1244 #. ``*``.txt -> parent/a.txt, parent/b.txt
1245 #. foo/``*``.txt`` -> parent/foo/a.txt, parent/foo/b.txt
1246 #. ``*/*.txt`` -> (``*``, ``*``/``*``.txt) -> parent/c/a.txt, parent/d/b.txt
1247 #. (sun, file.txt) -> parent/sun/file.txt
1248 #. (sun, bar/file.txt) -> parent/sun/file.txt
1249 #. (sun, /foo/bar/file.txt) -> parent/sun/file.txt
1250 #. (sun, ``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt
1251 #. (sun, bar/``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt
1252 #. (sun/``*``, ``*``/``*``.txt) -> parent/sun/c/a.txt, parent/d/b.txt
1253
1254 An additional feature is that the path to a data-file can actually be
1255 a function that takes no arguments and returns the actual path(s) to
1256 the data-files. This is useful when the data files are generated while
1257 building the package.

Callers 15

configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
configurationFunction · 0.95
make_svn_version_pyMethod · 0.95
make_hg_version_pyMethod · 0.95

Calls 7

pathsMethod · 0.95
get_distributionMethod · 0.95
is_sequenceFunction · 0.85
is_stringFunction · 0.85
is_glob_patternFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected