I made a quick and dirty change of the code for windows. Thanks Codeboy2k. I removed the git path search, so please check if your git was installed in the same places as I set in the scripts. I also replace os.spawn with subprocess, because when I used os.spawnev, python crashed every time.
Finally, I removed the last step, which will copy fp-lib-table. Please manually do it. For windows, KiCad read fp-lib-table from x:\Users\*user_name*\AppData\Roaming\kicad, please manaully copy fp-lib-table.for-pretty as fp-lib-table, so KiCad will use $KIGITHUB instaed of $KISYSMOD.
in RunKiCad.bat add the following line to set path of KISYSMOD
SET KISYSMOD=C:\kicad-winbuilder-3.4\kicad\share\github-repo
clone-kicad-repo.py
#!/usr/bin/python
import re, os, sys, subprocess
import shutil
# change templatedir if you need to
# templatedir = '/usr/local/share/kicad/template'
templatedir = r'C:\kicad-winbuilder-3.4\kicad\share\template'
# set localdir to the location where you want to
# store your local copy of the GitHub repository
#localdir = '/usr/local/share/kicad/github-repo'
localdir = r'C:\kicad-winbuilder-3.4\kicad\share\github-repo'
github_table = 'fp-lib-table'
sys_table = 'fp-lib-table.for-pretty'
default_table = 'fp-lib-table'
env = {}
env.update(os.environ)
sep = ';' if (re.compile('^[wW][Ii][Nn]').match(sys.platform)) else ':'
KIGITHUB = 'https://github.com/KiCad'
found = None
paths = env['PATH'].split(sep)
for path in paths:
fpath = os.path.join(path,'git')
if (os.path.isfile(fpath) and os.access(fpath, os.X_OK)):
found = True
cmd = fpath
break
cmd = r'C:\Program Files (x86)\Git\bin'
# if not found:
# print "cannot find git executable"
# exit(1)
args = [r'C:\Program Files (x86)\Git\bin\git', 'clone', 'x']
os.chdir(localdir)
template = os.path.join(templatedir, github_table)
for line in open(template,'rU'):
mo = re.search(r'^.*\(\W*uri\W?([^)]*).*$',line)
if mo:
repo = mo.group(1).replace('${KIGITHUB}', KIGITHUB)
args[2]=repo
print localdir
print args
subprocess.call(args)
print 'done x'
print "you now have a local copy of the GitHub repository"
print "in : ", localdir
print "updating KiCad ... "
env['HOME']='C:\Users\xxx'
frompath = os.path.join(templatedir,sys_table)
topath = os.path.join(env['HOME'],default_table)
print ".. copying: ", frompath
print "...... to: ", topath
shutil.copyfile(frompath, topath)
print ".. done"
print
print "before running kicad, you will need to set"
print "the following environment variable:"
print
print "KISYSMOD=%s\n" % localdir