tartans working with py3

This commit is contained in:
Neale Pickett 2013-12-08 22:25:49 +00:00
parent 0ec6ce9da4
commit c7c4d333dc
3 changed files with 15 additions and 14 deletions

View File

@ -4,6 +4,7 @@
#define GIT_PROJECT_ROOT "/home/neale/projects" #define GIT_PROJECT_ROOT "/home/neale/projects"
#define CGIT_CONFIG "/home/neale/public_html/cgitrc" #define CGIT_CONFIG "/home/neale/public_html/cgitrc"
#define CGIT "/usr/lib/cgit/cgit.cgi"
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -16,7 +17,7 @@ main(int argc, char *argv[])
execlp("git", "git", "http-backend", NULL); execlp("git", "git", "http-backend", NULL);
} else { } else {
setenv("CGIT_CONFIG", CGIT_CONFIG, 1); setenv("CGIT_CONFIG", CGIT_CONFIG, 1);
execl("/usr/local/bin/cgit", "cgit", NULL); execl(CGIT, "cgit", NULL);
} }
return 0; return 0;

View File

@ -3,11 +3,11 @@
import cgitb; cgitb.enable() import cgitb; cgitb.enable()
import loom import loom
import cgi import cgi
import urllib import urllib.request, urllib.parse, urllib.error
import os import os
import sys import sys
os.chdir(os.path.dirname(sys.argv[0])) os.chdir("/home/neale/public_html/tartans")
f = cgi.FieldStorage() f = cgi.FieldStorage()
@ -33,7 +33,7 @@ else:
print('') print('')
sys.stdout.flush() sys.stdout.flush()
content = ('Name: %s\nSett: %s\n' % (t, s)) content = ('Name: %s\nSett: %s\n' % (t, s))
png = 'design.cgi?sett=%s' % urllib.quote(s_) png = 'design.cgi?sett=%s' % urllib.parse.quote(s_)
cvt = os.popen('./tartantomdwn %s tartan.m4 | ../mdwntohtml ../template.m4' % (png,), cvt = os.popen('./tartantomdwn %s tartan.m4 | ../mdwntohtml ../template.m4' % (png,),
'w') 'w')
cvt.write(content) cvt.write(content)

View File

@ -92,40 +92,40 @@ class PNGLoom(Loom):
def ascii_test(): def ascii_test():
print 'Plain weave' print('Plain weave')
l = Loom('||||||||||||||||||||||||||||||||') l = Loom('||||||||||||||||||||||||||||||||')
for i in range(16): for i in range(16):
l.plain_weave('-') l.plain_weave('-')
for row in l.fabric: for row in l.fabric:
print ' ', ''.join(row) print(' ', ''.join(row))
print 'Twill' print('Twill')
l = Loom('||||||||||||||||||||||||||||||||') l = Loom('||||||||||||||||||||||||||||||||')
for i in range(16): for i in range(16):
l.twill('-') l.twill('-')
for row in l.fabric: for row in l.fabric:
print ' ', ''.join(row) print(' ', ''.join(row))
print '2/1 twill' print('2/1 twill')
l = Loom('||||||||||||||||||||||||||||||||') l = Loom('||||||||||||||||||||||||||||||||')
for i in range(16): for i in range(16):
l.twill('-', 2, 1) l.twill('-', 2, 1)
for row in l.fabric: for row in l.fabric:
print ' ', ''.join(row) print(' ', ''.join(row))
print 'Satin weave' print('Satin weave')
l = Loom('||||||||||||||||||||||||||||||||') l = Loom('||||||||||||||||||||||||||||||||')
for i in range(16): for i in range(16):
l.satin_weave('-') l.satin_weave('-')
for row in l.fabric: for row in l.fabric:
print ' ', ''.join(row) print(' ', ''.join(row))
print 'Basketweave' print('Basketweave')
l = Loom('||||||||||||||||||||||||||||||||') l = Loom('||||||||||||||||||||||||||||||||')
for i in range(16): for i in range(16):
l.basket_weave('-') l.basket_weave('-')
for row in l.fabric: for row in l.fabric:
print ' ', ''.join(row) print(' ', ''.join(row))
## ##