Import Scripts¶
Import Scripts from a package to GRASS GIS.
This class will copy any suitable python file like ‘i_dr_import.py’ into the GRASS script folder, without the ‘.py’ extension and changes the name to ‘i.dr.import’. This class will exclude such files like ‘__init__.py’ or ‘setup.py’. For more exclusions the parameter exclusion can be used.
-
class
gscpy.i_script.
Grassify
(input_dir, export_path=None, pattern=None, exclusion=None)[source]¶ Import Scripts from a package to GRASS GIS.
This class will copy any suitable python file like ‘i_dr_import.py’ into the GRASS script folder without the ‘.py’ extension and changes the name to ‘i.dr.import’. This class will exclude such files like ‘__init__.py’ or ‘setup.py’. For more exclusions the parameter exclusion can be used.
Parameters: - input_dir (str) – Directory of python files
- export_path (str, optional) – Script directory of GRASS GIS (automatically in Linux systems).
- pattern (str, optional) – The pattern of file names.
- exclusion (str) – Which files or pattern should be excluded?.
-
extension
¶ list – A list which contains all supported GRASS GIS candidates.
-
exclusion
¶ str
-
import_path
¶ str – Dir parameter.
-
export_path
¶ str
-
filter_p
¶ str – Combines pattern and extension.
-
files
¶ list – All detected files.
Examples
The general usage is
$ i.script [-r-p] input_dir=string [pattern=string] [exclusion=string] [export_path=string] [--verbose] [--quiet]
Import all suitable python files from a directory into the GRASS script folder
$ i.script input_dir=/home/user/package
Import all suitable python files from a directory into the GRASS script folder and exclude all files that include the string ‘test’
$ i.script input_dir=/home/user/package exclude=test.*
Note
This class copies all files and replaces all ‘_’ with ‘.’.
Notes
- Flags:
- r : Overwrite file if it is existent (be careful padawan!)
- p : Print the detected files and exit.