Skip to content

Commit 6870440

Browse files
authored
Merge pull request #25 from JarrettR/library-integration
Library integration
2 parents 82d1ad8 + 1bce2e1 commit 6870440

File tree

5 files changed

+106
-0
lines changed

5 files changed

+106
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
![logo](docs/logo.png)
3+
14
# Stretch
25

36
Allow your PCBs to _stretch_!

docs/logo.png

54.4 KB
Loading

pcm/build.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Thx Greg Davill
2+
# https://github.com/gregdavill/KiBuzzard
3+
4+
5+
import os
6+
from os import path
7+
import shutil
8+
9+
src_path = path.join(os.path.abspath(path.dirname(__file__)),'..','Stretch')
10+
11+
metadata_template = path.join(os.path.abspath(path.dirname(__file__)),'metadata_template.json')
12+
resources_path = path.join(os.path.abspath(path.dirname(__file__)),'resources')
13+
print(src_path)
14+
15+
build_path = os.path.abspath(path.join('build'))
16+
17+
try:
18+
shutil.rmtree(build_path)
19+
except FileNotFoundError:
20+
pass
21+
os.mkdir(build_path)
22+
os.mkdir(path.join(build_path,'plugin'))
23+
os.chdir(build_path)
24+
25+
shutil.copytree(src_path, path.join(os.path.abspath('plugin'),'plugins'))
26+
27+
# clean out any __pycache__ or .pyc files (https://stackoverflow.com/a/41386937)
28+
import pathlib
29+
[p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]
30+
[p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]
31+
32+
33+
# copy metadata
34+
shutil.copy(metadata_template, path.join('plugin','metadata.json'))
35+
# copy icon
36+
shutil.copytree(resources_path, path.join('plugin','resources'))
37+
38+
# load up json script
39+
from pathlib import Path
40+
import json
41+
with open(metadata_template) as f:
42+
md = json.load(f)
43+
44+
45+
46+
# zip all files
47+
zip_file = 'Stretch-{0}-pcm.zip'.format(md['versions'][0]['version'])
48+
shutil.make_archive(Path(zip_file).stem, 'zip', 'plugin')
49+
50+
51+
zip_size = path.getsize(zip_file)
52+
53+
54+
uncompressed_size = sum(f.stat().st_size for f in Path('plugin').glob('**/*') if f.is_file())
55+
56+
import hashlib
57+
with open(zip_file, 'rb') as f:
58+
zip_sha256 = hashlib.sha256(f.read()).hexdigest()
59+
60+
61+
62+
md['versions'][0].update({
63+
'install_size': uncompressed_size,
64+
'download_size': zip_size,
65+
'download_sha256': zip_sha256,
66+
'download_url': 'https://github.com/JarrettR/Stretch/releases/download/{0}/Stretch-{0}-pcm.zip'.format(md['versions'][0]['version'])
67+
})
68+
69+
with open('metadata.json', 'w') as of:
70+
json.dump(md, of, indent=2)

pcm/metadata_template.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://go.kicad.org/pcm/schemas/v1",
3+
"name": "Stretch",
4+
"description": "KiCad to SVG and then back again",
5+
"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.",
6+
"identifier": "com.github.jarrettr.stretch",
7+
"type": "plugin",
8+
"author": { "name": "Jarrett Rainier",
9+
10+
"contact": {
11+
"github": "https://github.com/JarrettR",
12+
"web": "https://jrainimo.com"
13+
}
14+
},
15+
"maintainer": {
16+
"name": "Jarrett Rainier",
17+
"contact": {
18+
"github": "https://github.com/JarrettR",
19+
"web": "https://jrainimo.com"
20+
}
21+
},
22+
"license": "GPL-3.0",
23+
"resources": {
24+
"homepage": "https://github.com/JarrettR/Stretch"
25+
},
26+
"versions": [
27+
{
28+
"version": "1.2",
29+
"status": "stable",
30+
"kicad_version": "6.0"
31+
}
32+
]
33+
}

pcm/resources/bitmap.png

7.59 KB
Loading

0 commit comments

Comments
 (0)