-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from JarrettR/library-integration
Library integration
- Loading branch information
Showing
5 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
|
||
![logo](docs/logo.png) | ||
|
||
# Stretch | ||
|
||
Allow your PCBs to _stretch_! | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Thx Greg Davill | ||
# https://github.com/gregdavill/KiBuzzard | ||
|
||
|
||
import os | ||
from os import path | ||
import shutil | ||
|
||
src_path = path.join(os.path.abspath(path.dirname(__file__)),'..','Stretch') | ||
|
||
metadata_template = path.join(os.path.abspath(path.dirname(__file__)),'metadata_template.json') | ||
resources_path = path.join(os.path.abspath(path.dirname(__file__)),'resources') | ||
print(src_path) | ||
|
||
build_path = os.path.abspath(path.join('build')) | ||
|
||
try: | ||
shutil.rmtree(build_path) | ||
except FileNotFoundError: | ||
pass | ||
os.mkdir(build_path) | ||
os.mkdir(path.join(build_path,'plugin')) | ||
os.chdir(build_path) | ||
|
||
shutil.copytree(src_path, path.join(os.path.abspath('plugin'),'plugins')) | ||
|
||
# clean out any __pycache__ or .pyc files (https://stackoverflow.com/a/41386937) | ||
import pathlib | ||
[p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')] | ||
[p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')] | ||
|
||
|
||
# copy metadata | ||
shutil.copy(metadata_template, path.join('plugin','metadata.json')) | ||
# copy icon | ||
shutil.copytree(resources_path, path.join('plugin','resources')) | ||
|
||
# load up json script | ||
from pathlib import Path | ||
import json | ||
with open(metadata_template) as f: | ||
md = json.load(f) | ||
|
||
|
||
|
||
# zip all files | ||
zip_file = 'Stretch-{0}-pcm.zip'.format(md['versions'][0]['version']) | ||
shutil.make_archive(Path(zip_file).stem, 'zip', 'plugin') | ||
|
||
|
||
zip_size = path.getsize(zip_file) | ||
|
||
|
||
uncompressed_size = sum(f.stat().st_size for f in Path('plugin').glob('**/*') if f.is_file()) | ||
|
||
import hashlib | ||
with open(zip_file, 'rb') as f: | ||
zip_sha256 = hashlib.sha256(f.read()).hexdigest() | ||
|
||
|
||
|
||
md['versions'][0].update({ | ||
'install_size': uncompressed_size, | ||
'download_size': zip_size, | ||
'download_sha256': zip_sha256, | ||
'download_url': 'https://github.com/JarrettR/Stretch/releases/download/{0}/Stretch-{0}-pcm.zip'.format(md['versions'][0]['version']) | ||
}) | ||
|
||
with open('metadata.json', 'w') as of: | ||
json.dump(md, of, indent=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://go.kicad.org/pcm/schemas/v1", | ||
"name": "Stretch", | ||
"description": "KiCad to SVG and then back again", | ||
"description_full": "Seamless artistic workflow for KiCad and Inkscape.\n\nUsers can start by drawing a schematic and laying out a PCB, then bring it into Inkscape to arrange a thousand LEDs into a flower arrangement, then bring it back into KiCad to lay out traces, back into Inkscape to curve the traces, back into KiCad to change their microcontroller and few pin assignments, back into Inkscape to draw out some silkscreem patterns, back into KiCad to run DRC, and so on. The workflow is intended to be seamless and painless to go back and forth.", | ||
"identifier": "com.github.jarrettr.stretch", | ||
"type": "plugin", | ||
"author": { "name": "Jarrett Rainier", | ||
|
||
"contact": { | ||
"github": "https://github.com/JarrettR", | ||
"web": "https://jrainimo.com" | ||
} | ||
}, | ||
"maintainer": { | ||
"name": "Jarrett Rainier", | ||
"contact": { | ||
"github": "https://github.com/JarrettR", | ||
"web": "https://jrainimo.com" | ||
} | ||
}, | ||
"license": "GPL-3.0", | ||
"resources": { | ||
"homepage": "https://github.com/JarrettR/Stretch" | ||
}, | ||
"versions": [ | ||
{ | ||
"version": "1.2", | ||
"status": "stable", | ||
"kicad_version": "6.0" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.