Create directories

main
Bob Mottram 2020-05-02 16:53:20 +00:00
parent b458e06feb
commit 79048c29b9
1 changed files with 10 additions and 5 deletions

15
git.py
View File

@ -83,7 +83,10 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
patchLines = contentStr.split('\n') patchLines = contentStr.split('\n')
patchFilename = None patchFilename = None
patchDir = None projectDir = None
patchesDir = \
baseDir + '/accounts/' + nickname + '@' + domain + \
'/patches'
# get the subject line and turn it into a filename # get the subject line and turn it into a filename
for line in patchLines: for line in patchLines:
if line.startswith('Subject:'): if line.startswith('Subject:'):
@ -93,11 +96,13 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
patchSubject = patchSubject.replace(' ', '_') patchSubject = patchSubject.replace(' ', '_')
projectName = \ projectName = \
getGitProjectName(baseDir, nickname, domain, subject) getGitProjectName(baseDir, nickname, domain, subject)
patchDir = \ if not os.path.isdir(patchesDir):
baseDir + '/accounts/' + nickname + '@' + domain + \ os.mkdir(patchesDir)
'/patches/' + projectName projectDir = patchesDir + '/' + projectName
if not os.path.isdir(projectDir):
os.mkdir(projectDir)
patchFilename = \ patchFilename = \
patchDir + '/' + patchSubject + '.patch' projectDir + '/' + patchSubject + '.patch'
break break
if not patchFilename: if not patchFilename:
return False return False