This commit is contained in:
Raffu Khondaker 2020-06-10 05:55:13 -04:00
parent 6f2b380647
commit 4ea39ae8de
9 changed files with 773 additions and 18 deletions

256
CLI/s-git-oldd.py Normal file
View File

@ -0,0 +1,256 @@
import subprocess
import os
import requests
import webbrowser
import pprint
import json
import shutil
import time
import pyperclip
#git clone student directory ==> <student-id>/classes/assignments
#get teacher info from api
def getStudent(ion_user):
URL = "http://127.0.0.1:8000/students/" + ion_user + "/"
r = requests.get(url = URL, auth=('raffukhondaker','hackgroup1'))
if(r.status_code == 200):
data = r.json()
return data
elif(r.status_code == 404):
return None
print("Make new account!")
elif(r.status_code == 403):
return None
print("Invalid username/password")
else:
return None
print(r.status_code)
def getDB(url):
r = requests.get(url = url, auth=('raffukhondaker','hackgroup1'))
print("GET:" + str(r.status_code))
return(r.json())
def postDB(data, url):
r = requests.post(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
print("POST:" + str(r.status_code))
return(r.json())
def putDB(data, url):
r = requests.put(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
print("PUT:" + str(r.status_code))
return(r.json())
def delDB(url):
r = requests.delete(url = url, auth=('raffukhondaker','hackgroup1'))
print("DELETE:" + str(r.status_code))
return None
def command(command):
ar = []
command = command.split(" ")
for c in command:
ar.append(c)
process = subprocess.Popen(ar, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p=process.poll()
output = process.communicate()[1]
print(output.decode('utf-8'))
####################################################################################################################################
#public methods: deleteClass, makeClass, update
class Student:
def __init__(self, data):
# teacher info already stored in API
# intitialze fields after GET request
self.first_name=data['first_name']
self.last_name=data['last_name']
self.git=data['git']
self.username=data['ion_user']
self.url= "http://127.0.0.1:8000/students/" + self.username + "/"
self.email = data['email']
self.grade = data['grade']
self.student_id=data['student_id']
self.completed = data['completed']
#classes in id form (Example: 4,5)
#storing actual classes
cid=data['classes'].split(",")
try:
cid.remove('')
except:
pass
try:
cid.remove("")
except:
pass
classes=[]
for c in cid:
url = "http://127.0.0.1:8000/classes/" + str(c) + "/"
classes.append(getDB(url))
self.classes = classes
self.sclass=str(data['classes'])
#storing added_to classes
nid=data['added_to'].split(",")
try:
nid.remove('')
except:
pass
try:
nid.remove("")
except:
pass
nclasses=[]
for c in nid:
url = "http://127.0.0.1:8000/classes/" + str(c) + "/"
nclasses.append(getDB(url))
self.new = nclasses
self.snew=str(data['added_to'])
if(os.path.isdir(self.username)):
print("Synced to " + self.username)
else:
os.mkdir(self.username)
#update API and Github, all assignments / classes
def update(self):
#lists all classes
ignore=['.DS_Store']
classes = os.listdir(self.username)
for i in ignore:
try:
classes.remove(i)
except:
pass
for i in range(len(classes)):
c = classes[i]
path = self.username + "/" + c
#lists all assignments and default files
#push to git
isclass = False
for d in os.listdir(path):
if(d == '.git'):
isclass=True
break
if(isclass):
loc = os.getcwd()
os.chdir(path)
command('git fetch origin')
command('git checkout ' + self.username)
command('git add .')
command('git commit -m ' + self.username + '-update')
command('git push -u origin ' + self.username)
command('git merge master')
os.chdir(loc)
print("Updated: " + c)
else:
print(d + " is not a class")
#class name format: <course-name>_<ion_user>
#add classes from 'new' field
def addClass(self, cid):
if((cid in self.snew) == False):
if((cid in self.sclass) == True):
print("Already enrolled in this class.")
else:
print("Not added by teacher yet.")
return None
data = getDB('http://127.0.0.1:8000/classes/'+cid)
#clone class repo and make student branch (branch name: username)
os.chdir(self.username)
command("git clone " + data['repo'])
os.chdir(data['name'])
command("git checkout " + self.username)
command("git push -u origin " + self.username)
self.classes.append(data)
if(len(self.sclass)==0):
self.sclass = data['id']
else:
self.sclass = self.sclass + "," + str(data['id'])
#upddate self.new
s=""
nar = ''
for i in range(len(self.new)):
if(self.new[i]['id'] == int(data['id'])):
print("DELETE: " + self.new[i]['name'])
del self.new[i]
#recreate sclass field, using ids
for c in self.new:
s = s + str(c['id']) + ","
nar.append(c)
self.snew=s
self.new=nar
break
#update teacher instance in db, classes field
data={
'first_name':self.first_name,
'last_name':self.last_name,
'git':self.git,
'ion_user':self.username,
'student_id':self.student_id,
'added_to':self.snew,
'url':self.url,
'classes':self.sclass,
'email':self.email,
'grade':self.grade,
'completed':self.completed
}
print(self.url)
print(putDB(data, self.url))
return data
def submit(self, path):
#2022rkhondak/English11_eharris1/Essay1
#check if valid assignment
parts = path.split("/")
if(len(parts) != 3):
print("Assignment path too short")
return
isclass = False
for c in self.classes:
if(c['name'] == parts[1]):
isclass==True
break
if(parts[0] != self.username and isclass and os.path.isdir(path) == False):
print("Not valid assignment")
return
if((parts[1] + "/" + parts[2]) in self.completed):
print(parts[2] + " already submited. ")
# return
resp = input("Are you sure you want to submit? You cannot do this again.(y/N) ")
if(resp == 'y'):
os.chdir(self.username + "/" + parts[1])
command("git add .")
command("git commit -m submit")
command("git tag " + parts[1] + "-final")
command("git push -u origin " + self.username + " --tags")
self.completed = self.completed + "," + parts[1] + "/" + parts[2]
data={
'first_name':self.first_name,
'last_name':self.last_name,
'git':self.git,
'ion_user':self.username,
'student_id':self.student_id,
'added_to':self.snew,
'url':self.url,
'classes':self.sclass,
'email':self.email,
'grade':self.grade,
'completed':self.completed
}
#print(putDB(data, "http://127.0.0.1:8000/students/" + self.username + "/"))
data = getStudent("2022rkhondak")
s = Student(data)
s.update()

View File

@ -54,7 +54,7 @@ def command(command):
ar.append(c) ar.append(c)
process = subprocess.Popen(ar, stdout=subprocess.PIPE,stderr=subprocess.PIPE) process = subprocess.Popen(ar, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p=process.poll() p=process.poll()
output = process.communicate()[1] output = process.communicate()[0]
print(output.decode('utf-8')) print(output.decode('utf-8'))
#################################################################################################################################### ####################################################################################################################################
@ -74,7 +74,6 @@ class Student:
self.student_id=data['student_id'] self.student_id=data['student_id']
self.completed = data['completed'] self.completed = data['completed']
#classes in id form (Example: 4,5) #classes in id form (Example: 4,5)
#storing actual classes #storing actual classes
cid=data['classes'].split(",") cid=data['classes'].split(",")
try: try:
@ -110,11 +109,32 @@ class Student:
self.new = nclasses self.new = nclasses
self.snew=str(data['added_to']) self.snew=str(data['added_to'])
if(os.path.isdir(self.username)): self.repo = data['repo']
print("Synced to " + self.username) if(self.repo == ""):
else: user= self.git
os.mkdir(self.username) pwd= input("Enter Github password: ")
#curl -i -u USER:PASSWORD -d '{"name":"REPO"}' https://api.github.com/user/repos
url= "curl -i -u " + user + ":" + pwd + " -d '" + '{"name":"' + self.username + '"}' + "' " + "https://api.github.com/user/repos"
os.system(url)
command('git clone https://github.com/' + self.git + '/' + self.username + '.git')
self.repo = 'https://github.com/' + self.git + '/' + self.username + '.git'
print(url)
data={
'first_name':self.first_name,
'last_name':self.last_name,
'git':self.git,
'ion_user':self.username,
'student_id':self.student_id,
'added_to':self.snew,
'url':self.url,
'classes':self.sclass,
'email':self.email,
'grade':self.grade,
'completed':self.completed,
'repo':self.repo
}
print(putDB(data, self.url))
print("Synced to " + self.username)
#update API and Github, all assignments / classes #update API and Github, all assignments / classes
def update(self): def update(self):
@ -162,15 +182,24 @@ class Student:
else: else:
print("Not added by teacher yet.") print("Not added by teacher yet.")
return None return None
pwd= input("Enter Github password: ")
url= "curl -i -u " + user + ":" + pwd + " -X PUT -d '' " + "'https://api.github.com/repos/" + self.git + "/" + data['name'] + "/collaborators/" + data['teacher'] + "'"
data = getDB('http://127.0.0.1:8000/classes/'+cid) data = getDB('http://127.0.0.1:8000/classes/'+cid)
data['unconfirmed'] = data['unconfirmed'].replace("," + self.username, "")
data['unconfirmed'] = data['unconfirmed'].replace(self.username, "")
data['confirmed'] = data['confirmed'] + "," + self.username
if(data['confirmed'][0] == ','):
data['confirmed'] = data['confirmed'][1:]
print(data['confirmed'])
print(putDB(data, 'http://127.0.0.1:8000/classes/'+cid + "/"))
#clone class repo and make student branch (branch name: username) #add teacher as collaborator
os.chdir(self.username) #curl -i -u "USER:PASSWORDD" -X PUT -d '' 'https://api.github.com/repos/USER/REPO/collaborators/COLLABORATOR'
command("git clone " + data['repo']) user = self.git
os.chdir(data['name']) print(url)
command("git checkout " + self.username) os.system(url)
command("git push -u origin " + self.username)
self.classes.append(data) self.classes.append(data)
if(len(self.sclass)==0): if(len(self.sclass)==0):
self.sclass = data['id'] self.sclass = data['id']
@ -182,7 +211,6 @@ class Student:
nar = '' nar = ''
for i in range(len(self.new)): for i in range(len(self.new)):
if(self.new[i]['id'] == int(data['id'])): if(self.new[i]['id'] == int(data['id'])):
print("DELETE: " + self.new[i]['name'])
del self.new[i] del self.new[i]
#recreate sclass field, using ids #recreate sclass field, using ids
for c in self.new: for c in self.new:
@ -253,4 +281,4 @@ class Student:
data = getStudent("2022rkhondak") data = getStudent("2022rkhondak")
s = Student(data) s = Student(data)
s.update() s.addClass('57')

439
CLI/t-git.py Normal file
View File

@ -0,0 +1,439 @@
import subprocess
import os
import requests
import webbrowser
import pprint
import json
import shutil
import time
import pyperclip
from distutils.dir_util import copy_tree
#git clone student directory ==> <student-id>/classes/assignments
#get teacher info from api
def getTeacher(ion_user):
URL = "http://127.0.0.1:8000/teachers/" + ion_user + "/"
r = requests.get(url = URL, auth=('raffukhondaker','hackgroup1'))
if(r.status_code == 200):
data = r.json()
return data
elif(r.status_code == 404):
return None
print("Make new account!")
elif(r.status_code == 403):
return None
print("Invalid username/password")
else:
return None
print(r.status_code)
def getDB(url):
r = requests.get(url = url, auth=('raffukhondaker','hackgroup1'))
print("GET:" + str(r.status_code))
return(r.json())
def postDB(data, url):
r = requests.post(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
print("POST:" + str(r.status_code))
return(r.json())
def putDB(data, url):
r = requests.put(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
print("PUT:" + str(r.status_code))
return(r.json())
def delDB(url):
r = requests.delete(url = url, auth=('raffukhondaker','hackgroup1'))
print("DELETE:" + str(r.status_code))
return None
def command(command):
ar = []
command = command.split(" ")
for c in command:
ar.append(c)
process = subprocess.Popen(ar, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p=process.poll()
output = process.communicate()[1]
#print(output.decode('utf-8'))
####################################################################################################################################
#public methods: deleteClass, makeClass, update
class Teacher:
def __init__(self, data):
# teacher info already stored in API
# intitialze fields after GET request
self.first_name=data['first_name']
self.last_name=data['last_name']
self.git=data['git']
self.username=data['ion_user']
self.url= "http://127.0.0.1:8000/teachers/" + self.username + "/"
self.email = data['email']
#classes in id form (Example: 4,5)
cid=data['classes'].split(",")
try:
cid.remove('')
except:
pass
try:
cid.remove("")
except:
pass
classes=[]
for c in cid:
url = "http://127.0.0.1:8000/classes/" + str(c) + "/"
classes.append(getDB(url))
self.classes = classes
self.sclass=str(data['classes'])
if(os.path.isdir(self.username)):
print("Synced to " + self.username)
else:
os.mkdir(self.username)
#update API and Github, all assignments / classes
def update(self):
#lists all classes
ignore=['.git','.DS_Store']
classes = os.listdir(self.username)
for i in ignore:
try:
classes.remove(i)
except:
pass
#list of classes that have been deleted (not with deleteClass)
extra = []
for c in self.classes:
extra.append(c)
for i in range(len(extra)):
e = extra[i]['path']
extra[i] = e
print("Extra: "+str(extra))
print("Local:" + str(classes))
#checks all class directories first
for c in classes:
path = self.username + "/" + c
if(self.checkClass(path) == False):
return
extra.remove(path)
print("Current classes: " + path)
for e in extra:
self.deleteClass(e)
for i in range(len(classes)):
c = classes[i]
path = self.username + "/" + c
#lists all assignments and default files
#if no .git, directory not synced to git or API
if (self.checkInDB(path)==False):
self.addClass(path)
else:
#push to git
loc = os.getcwd()
os.chdir(path)
command('git fetch origin')
command('git pull origin master')
command('git add .')
command('git commit -m "Update"')
command('git push -u origin master')
os.chdir(loc)
#class name format: <course-name>_<ion_user>
#turn existing directory into class, Pre-condition: directory exists
#relative path to class: 2022rkhondak/Math4
def checkClass(self,path):
cname = path.split("/")
cname = cname[len(cname)-1]
if(os.path.isfile(path)):
print(path + " must be in a Class directory.")
return False
if(("_" + self.username) in cname) == False:
print("Incorrect class name: Must be in the format: " + self.username+ "/<course-name>_<ion_user>, not " + path)
return False
dirs = os.listdir(path)
#checks if there is a file (not within Assignments) in class, need at least 1
deffile = False
#checks if there is a file in an Assignment, need at least 1 (default True in case no assignments)
as_file = True
as_bad = ""
for d in dirs:
if(os.path.isfile(d)):
deffile=True
else:
#checks if there is a file in an Assignment, need at least 1
as_file = False
asdir = os.listdir(path + "/" + d)
for a in asdir:
if(os.path.isfile(path + "/" + d + "/" +a)):
as_file=True
if(as_file==False):
as_bad = d
break
if(as_file==False):
print("Assignment '" + as_bad + "' does not have a default file!")
return False
if(deffile==False):
print("Need a default file in the " + path + " Directory!")
return False
return True
def checkInDB(self, path):
n = path.split("/")
n = n[len(n)-1]
for c in self.classes:
if(n == c['name']):
return True
return False
#adds class to git, not API
#Assuming valid class name
def addClasstoGit(self, path):
cname = path.split("/")
cname = cname[len(cname)-1]
#push to remote repo
url='https://github.com/' + self.git + "/" + cname
if(requests.get(url).status_code != 200):
input("Make new Git Repo with name: " + cname + " (Press any key to continue)\n")
try:
pyperclip.copy(cname)
print(cname + " copied to clipboard.")
except:
pass
time.sleep(2)
webbrowser.open('https://github.com/new')
input("Repo created? (Press any key to continue)\n")
print(url)
while(requests.get(url).status_code != 200):
r = input("Repo not created yet. (Press any key to continue after repo created, or 'N' to exit)\n")
if(r=="N" or r=="No"):
return None
cdir = os.getcwd()
os.chdir(path)
command('git init')
command('git add .')
command('git commit -m Hello_Class')
command('git remote add origin ' + url + '.git')
command('git push -u origin master')
else:
cdir = os.getcwd()
os.chdir(path)
print("Repo already exists. Cloning instead.")
command('git clone')
command('git fetch origin')
command('git pull')
command('git add .')
command('git commit -m Hello_Class')
command('git push -u origin master')
os.chdir(cdir)
print(cdir)
data={
'name':cname,
'repo':url,
'path':path,
'teacher':self.username,
}
return data
#make class from existing directory, add to git and api
def addClass(self, path):
if (self.checkClass(path)):
cname = path.split("/")
cname = cname[len(cname)-1]
cpath = self.username + "/" + cname[len(cname)-1]
data = {
"name": cname,
"repo": "",
"path": cpath,
"teacher": self.username,
"assignments": "",
"default_file": "",
"confirmed": "",
"unconfirmed": ""
}
#make class instance in db
data = postDB(data, 'http://127.0.0.1:8000/classes/')
#add to instance
#upate self.classes
self.classes.append(data)
if(len(self.sclass)==0):
self.sclass = data['id']
else:
self.sclass = self.sclass + "," + str(data['id'])
#update teacher instance in db, classes field
data={
'first_name':self.first_name,
'last_name':self.last_name,
'git':self.git,
'ion_user':self.username,
'url':self.url,
'classes':self.sclass,
'email':self.email
}
putDB(data, self.url)
return data
#make a new class from scratch
#subject: string, assignments: list
#class name must be: <subject>_<ion_user>
def makeClass(self, cname, assignments):
#check if class exists
path = self.username + "/" + cname
if(os.path.exists(path)):
print("Class already exists: " + cname)
return
else:
if((("_" + self.username) in cname) == False):
print("class name must be: "+ cname + "_" + self.username)
return
cdir = os.getcwd()
os.mkdir(path)
f=open(path + "/README.md", "w")
f.close()
#push to remote repo
os.chdir(path)
for a in assignments:
os.mkdir(a)
f=open(a + "/instructions.txt", "w")
f.close()
os.chdir(cdir)
data = self.addClass(path)
return data
def deleteClass(self, path):
if(os.path.exists(path) == False):
print(path + " does not exist locally.")
resp = input("Do you want to delete " + path + " from the SkoolOS system? (y/N) ")
if(resp != 'y'):
return
cname = path.split("/")
cname = cname[len(cname)-1]
cid = None
repo = ''
for c in self.classes:
if cname == c['name']:
cid = str(c['id'])
repo = c['repo']
#remove from api
for i in range(len(self.classes)):
if(self.classes[i]['id'] == int(cid)):
print("DELETE: " + self.classes[i]['name'])
del self.classes[i]
s=""
#recreate sclass field, using ids
for c in self.classes:
s = s + str(c['id']) + ","
print(s)
s = s[:-1]
print(s)
data={
'first_name':self.first_name,
'last_name':self.last_name,
'git':self.git,
'ion_user':self.username,
'url':self.url,
'classes':s,
'email':self.email
}
print(putDB(data, self.url))
delDB("http://127.0.0.1:8000/classes/" + cid + "/")
break
#remove locally
try:
shutil.rmtree(path)
except:
pass
#remove from student directories
#make student repo by student id
def reqStudent(self, student, classes):
cid = None
for c in self.classes:
print(c['name'])
if classes == c['name']:
cid = str(c['id'])
if(cid==None):
print(classes +" does not exist.")
return
data = getDB("http://127.0.0.1:8000/students/" + student)
try:
if(data['added_to']==""):
data['added_to']=cid
else:
data['added_to']=data['added_to']+ "," + cid
except:
print(student + " does not exist.")
return
print(data['added_to'])
d={
'first_name':data["first_name"],
'last_name':data["last_name"],
'git':data["git"],
'ion_user':data["ion_user"],
'student_id':data["student_id"],
'added_to':data['added_to'],
'classes':data["classes"],
'email':data["email"],
'grade':data["grade"],
'completed':data["completed"],
'repo':data["repo"]
}
print(putDB(d, data['url']))
data1 = getDB("http://127.0.0.1:8000/classes/" + cid)
if(data1['unconfirmed']==""):
data1['unconfirmed']=data['ion_user']
else:
data1['unconfirmed']=data1['unconfirmed']+ "," + data['ion_user']
d = {
"name": classes,
"repo": "",
"path": self.username + "/" + classes,
"teacher": self.username,
"assignments": "",
"default_file": "",
"confirmed": "",
"unconfirmed": data1['unconfirmed']
}
print(putDB(d, data1['url']))
#confirmed students
def addStudent(self, student, classes):
cdir = os.getcwd()
cpath = self.username + "/" + classes
path = "Students/" + classes
if(os.path.isdir(path) == False):
os.mkdir(path)
os.chdir(path)
student = getDB("http://127.0.0.1:8000/students/" + student)
command("git clone " + student['repo'])
os.chdir(cdir)
shutil.copytree(path, cpath + "/" + student['ion_user'])
command('git branch ' + classes)
command('git add .')
command('git commit -m Hello')
command('git push -u origin ' + classes)
def comment(self):
print("heheheh")
data = getTeacher("eharris1")
t = Teacher(data)
t.addStudent('2022rkhondak','English11_eharris1')

View File

@ -0,0 +1,28 @@
# Generated by Django 3.0.7 on 2020-06-10 06:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_student_completed'),
]
operations = [
migrations.AddField(
model_name='classes',
name='confirmed',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='classes',
name='unconfirmed',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='student',
name='repo',
field=models.URLField(blank=True, default=''),
),
]

View File

@ -25,6 +25,8 @@ class Classes(models.Model):
teacher=models.CharField(max_length=100, default="") teacher=models.CharField(max_length=100, default="")
assignments=models.CharField(max_length=100, default="") assignments=models.CharField(max_length=100, default="")
default_file=models.CharField(max_length=100, default="") default_file=models.CharField(max_length=100, default="")
confirmed=models.TextField(default="", blank=True)
unconfirmed=models.TextField(default="", blank=True)
# assignments = models.ManyToManyField(Assignment, default="") # assignments = models.ManyToManyField(Assignment, default="")
# default_file = models.ManyToManyField(DefFiles) # default_file = models.ManyToManyField(DefFiles)
@ -50,6 +52,7 @@ class Student(models.Model):
email=models.CharField(max_length=100, default="", blank=True) email=models.CharField(max_length=100, default="", blank=True)
grade = models.IntegerField() grade = models.IntegerField()
git=models.CharField(max_length=100) git=models.CharField(max_length=100)
repo=models.URLField(default="", blank=True)
classes=models.CharField(max_length=100, default="", blank=True) classes=models.CharField(max_length=100, default="", blank=True)
added_to=models.CharField(max_length=100, default="", blank=True) added_to=models.CharField(max_length=100, default="", blank=True)
completed=models.TextField(default="", blank=True) completed=models.TextField(default="", blank=True)

View File

@ -20,13 +20,13 @@ class ClassesSerializer(serializers.HyperlinkedModelSerializer):
# default_file=DefFilesSerializer(many=True, read_only=True,allow_null=True) # default_file=DefFilesSerializer(many=True, read_only=True,allow_null=True)
class Meta: class Meta:
model = Classes model = Classes
fields = ['url', 'name', 'repo','path', "teacher",'assignments',"default_file",'id'] fields = ['url', 'name', 'repo','path', "teacher",'assignments',"default_file",'id', 'confirmed', 'unconfirmed']
class StudentSerializer(serializers.HyperlinkedModelSerializer): class StudentSerializer(serializers.HyperlinkedModelSerializer):
# classes = ClassesSerializer(many=True, read_only=True,allow_null=True) # classes = ClassesSerializer(many=True, read_only=True,allow_null=True)
class Meta: class Meta:
model = Student model = Student
fields = ['url', 'first_name', 'last_name', 'grade','email','student_id', 'git','ion_user','classes','added_to','completed'] fields = ['url', 'first_name', 'last_name', 'grade','email','student_id', 'git','ion_user','classes','added_to','completed', 'repo']
class TeacherSerializer(serializers.ModelSerializer): class TeacherSerializer(serializers.ModelSerializer):
# classes = ClassesSerializer(many=True, read_only=True,allow_null=True) # classes = ClassesSerializer(many=True, read_only=True,allow_null=True)

View File

@ -0,0 +1 @@
Subproject commit ead6265a08327f2cc099d1e61c01030d916e8cd9