Skip to content

Commit

Permalink
Script now offers a flag to change ignored files (#508)
Browse files Browse the repository at this point in the history
-e can be followed by a comma separated list of directories or files
which will be ignored. Old behavior is to only ignore .git. New default
is .git and raven.
  • Loading branch information
derekstucki authored and alfoa committed Jan 10, 2018
1 parent bf8fd5e commit fbee9e3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/install_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@
plugins_directory = os.path.abspath(os.path.join(app_path, "plugins"))
found_plugin_argument = False
force_copy = False
exclude_dirs = ['.git', 'raven']
for cnt, commarg in enumerate(sys.argv):
if commarg == "-s":
plugin_dir = os.path.abspath(sys.argv[cnt+1])
found_plugin_argument = True
if commarg == "-f":
force_copy = True
if commarg == "-e":
exclude_str = sys.argv[cnt+1]
# strip out whitespace
exclude_str = "".join(exclude_str.split())
exclude_dirs = exclude_str.split(',')
if not found_plugin_argument:
raise IOError('Source directory for plugin installation not found! USE the syntax "-s path/to/plugin/orginal/location"!')

Expand Down Expand Up @@ -60,6 +66,10 @@
if os.path.exists(destination_plugin):
shutil.rmtree(destination_plugin)
# start copying
shutil.copytree(plugin_dir , destination_plugin ,ignore=shutil.ignore_patterns(".git"))
shutil.copytree(
plugin_dir,
destination_plugin,
ignore=shutil.ignore_patterns(*exclude_dirs)
)
print('Installation of plugin "'+plugin_name+'" performed successfully!')

0 comments on commit fbee9e3

Please sign in to comment.