From 3051ac5e57c7e435c5778c5da0868089e9232292 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sun, 12 Jul 2020 11:04:10 +0530 Subject: [PATCH] fix: Use gitpython module instead of subprocess --- frappe/utils/boilerplate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frappe/utils/boilerplate.py b/frappe/utils/boilerplate.py index ff4356e56d..7dfa2ca1b0 100755 --- a/frappe/utils/boilerplate.py +++ b/frappe/utils/boilerplate.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals, print_function from six.moves import input -import frappe, os, re +import frappe, os, re, git from frappe.utils import touch_file, cstr def make_boilerplate(dest, app_name): @@ -98,11 +98,11 @@ def make_boilerplate(dest, app_name): with open(os.path.join(dest, hooks.app_name, hooks.app_name, "config", "docs.py"), "w") as f: f.write(frappe.as_unicode(docs_template.format(**hooks))) - # initialize git + # initialize git repository app_directory = os.path.join(dest, hooks.app_name) - frappe.commands.popen('git init', cwd=app_directory) - frappe.commands.popen('git add .', cwd=app_directory) - frappe.commands.popen('git commit -m "Initialize app"', cwd=app_directory) + app_repo = git.Repo.init(app_directory) + app_repo.git.add(A=True) + app_repo.index.commit("feat: Initialize App") print("'{app}' created at {path}".format(app=app_name, path=app_directory))