diff --git a/scripts/module/create_gitignore.sh b/scripts/module/create_gitignore.sh index cf86ee39..e022da8b 100755 --- a/scripts/module/create_gitignore.sh +++ b/scripts/module/create_gitignore.sh @@ -13,7 +13,6 @@ then fi source ${QP_ROOT}/scripts/qp_include.sh - function do_gitingore() { cat << EOF > .gitignore diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index b491fd9d..ebbc367a 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -180,6 +180,11 @@ class ModuleHandler(): def create_png(self, l_module): """Create the png of the dependency tree for a l_module""" + # Don't update if we are not in the main repository + from is_master_repository import is_master_repository + if not is_master_repository: + return + basename = "tree_dependency" path = '{0}.png'.format(basename) @@ -289,6 +294,12 @@ if __name__ == '__main__': pass if arguments["create_git_ignore"]: + + # Don't update if we are not in the main repository + from is_master_repository import is_master_repository + if not is_master_repository: + sys.exit() + path = os.path.join(module_abs, ".gitignore") with open(path, "w+") as f: diff --git a/scripts/module/qp_update_readme.py b/scripts/module/qp_update_readme.py index 9ff9603b..d8768971 100755 --- a/scripts/module/qp_update_readme.py +++ b/scripts/module/qp_update_readme.py @@ -168,7 +168,15 @@ def update_documentation(d_readmen, root_module): d_readme[path]["documentation"] = "\n".join(l_doc_section) + if __name__ == '__main__': + + # Update documentation only if the remote repository is + # the main repository + from is_master_repository import is_master_repository + if not is_master_repository: + sys.exit(0) + arguments = docopt(__doc__) if arguments["--root_module"]: diff --git a/scripts/utility/is_master_repository.py b/scripts/utility/is_master_repository.py new file mode 100755 index 00000000..9ead14a2 --- /dev/null +++ b/scripts/utility/is_master_repository.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import subprocess +pipe = subprocess.Popen("git config --local --get remote.origin.url", \ + shell=True, stdout=subprocess.PIPE) +result = pipe.stdout.read() +is_master_repository = "LCPQ/quantum_package" in result + +if __name__ == "__main__": + import sys + if is_master_repository: + sys.exit(0) + else: + sys.exit(-1)