Change KIGITHUB to point to what?
Alexander.
Actually, it's not that simple.. I thought it would be :(
However, what I have done tonight is write a python script clone-kicad-repo.py that will pull the needed repositories from github, using the file (on linux) /usr/local/share/kicad/template/fp-lib-table.for-github
Using the contents of that file it will 'git clone' every single repository that is in that file into the subdirectory /usr/local/share/kicad/github-repo
Finally, it will copy /usr/local/share/kicad/template/fp-lib-table.for-pretty to your home directory as fp-lib-table. This is where kicad looks (why not in the .kicad subdir ?? dumbasses! )
As the last step to getting a local copy of the GitHub repositories, you need to set the environment variable KISYSMOD before running KiCad. This tells kicad to get the library from your local system.
KISYSMOD=/usr/local/share/kicad/github-repo
You can change these paths at the top of the script.
The second script I wrote is called update-kicad-repo.py. This script can be used after you already have the many repositories locally and want to update your local copy with a git pull. There are 71 repositories, you don't want to do it manually.
Air_Coils_SML_NEOSID.pretty : Already up-to-date.
Capacitors.pretty : Already up-to-date.
Capacitors_Elko_ThroughHole.pretty : Already up-to-date.
Capacitors_SMD.pretty : Already up-to-date.
Connect.pretty : Already up-to-date.
Connectors_Serial_MOLEX.pretty : Already up-to-date.
Converters_DCDC_ACDC.pretty : Already up-to-date.
Crystals.pretty : Already up-to-date.
Crystals_Oscillators_SMD.pretty : Already up-to-date.
Diodes_SMD.pretty : Already up-to-date.
Diodes_ThroughHole.pretty : Already up-to-date.
Discret.pretty : Already up-to-date.
Display.pretty : Already up-to-date.
The scripts are not polished but they work, and you can use them. I share them here for anyone else that wants to maintain a local copy of the GitHub repository.
One last word. This only clones the .pretty repositories for pcbnew, and does not clone the schematic repo at https://github.com/KiCad/kicad-library (https://github.com/KiCad/kicad-library)
posted as Linux only so far. I am going to test on Windows, and I will update this post for Windows after I install Windows, kicad and git into a fresh VirtualBox :)
Cheers!
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