-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenFonts.py
48 lines (39 loc) · 1.46 KB
/
genFonts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os, sys
count = 1
def cpFile( fileName, fileDir ):
global count
os.system( 'cp ' + fileDir + fileName + ' ' + 'fonts/' + str( count ) + '_' + fileName )
count += 1
def rollCommits( fileName, fileDir, gitHash ):
os.system( 'cd ' + fileDir + ' && git checkout ' + gitHash + ' ' + fileName )
os.system( 'cd - > /dev/null' )
def genGitLog( fileName, fileDir ):
os.system( 'cd ' + fileDir + '&& git log --pretty=%h ' + fileName + ' > gitLog' )
os.system( 'cd - > /dev/null' )
def gitLogToArray( fileDir ):
hashArray = open( fileDir + 'gitLog' ).read().splitlines()
##print( hashArray )
return hashArray
def process( fileName, fileDir ):
genGitLog( fileName, fileDir )
hashArray = gitLogToArray( fileDir )
for hashNum in hashArray:
rollCommits( fileName, fileDir, hashNum )
cpFile( fileName, fileDir )
def main( argv ):
fileName = fileDir = ""
if '-f' in argv:
fileName = argv[ argv.index( '-f' ) + 1 ]
##print( fileName )
if '-i' in argv:
fileDir = argv[ argv.index( '-i' ) + 1 ]
##print( fileDir )
process( fileName, fileDir )
else:
print( "no file location is given." )
print( "Usage : python3 gen.py -i [fileDirectory] -f [fileName]" )
else:
print( "no input file is given." )
print( "Usage : python3 gen.py -i [fileDirectory] -f [fileName]" )
if __name__ == "__main__":
main( sys.argv )