diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-01 21:52:31 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-01 21:53:24 +0200 |
commit | c8c3c9e922915b7eddc05973f6f938c6a0cbedaf (patch) | |
tree | 7b0303bfbfb41502d261f46ba351b1c324d3209c | |
parent | 0ebd2390a959a9562cf2096150ad6e8a24ed5ec9 (diff) | |
download | ee-python-c8c3c9e922915b7eddc05973f6f938c6a0cbedaf.tar.gz ee-python-c8c3c9e922915b7eddc05973f6f938c6a0cbedaf.tar.bz2 ee-python-c8c3c9e922915b7eddc05973f6f938c6a0cbedaf.tar.xz ee-python-c8c3c9e922915b7eddc05973f6f938c6a0cbedaf.zip |
o Removing all doit code. It was a failed experiment.
65 files changed, 0 insertions, 2920 deletions
diff --git a/NOTES.md b/NOTES.md deleted file mode 100644 index b547d89..0000000 --- a/NOTES.md +++ /dev/null @@ -1,97 +0,0 @@ -# Definitions - -dataset: -* set of objects -* -* Can be hand crafted or generated by a task -* Can be either a CSV file or ini file - -delta: the change from one version of an object to another. -the object needs a key - -database: collection of objects - -object: instance of a type. string key-values with a type - -# Tasks - -task: kicad-sch-to-dataset - input: - $sch - output: - data-set: - * name: kicad-sch - * types: - * kicad-schematic-component - * kicad-sheet - * kicad-design - -task: kicad-pcb-to-dataset - input: - $pcb - output: - data-set: - * name: kicad-pcb - * types: - * kicad-pcb-component - file: - gerber - -task: kicad-create-component-data-set - input: - * data-set: - * name: kicad-pcb - * data-set: - * name: kicad-sch - * uses types: - * kicad-schematic-component - * kicad-pcb-component - output: - data-set: - type: component - -task: validate-component - input: - type: component - output: - data-set: - type: component - -task: create-bom - input: - type: component - output: - data-set: (CSV) - type: bom-component - -## Customizations - -Case: your 'value' field is (usually) on the form 'Capacity/Max voltage/Tolerance' and you want to split this out into separate fields. - -Standard setup: - - * task: create-kicad-sch-objects - * inputs: none - * outputs: dataset:create-kicad-sch-objects - * task: create-kicad-sch-objects - * inputs: none - * outputs: dataset:create-kicad-sch-objects - -# Hand crafted datasets - -CSV files unless specified. - -* kicad-footprint-mapping: mappings from a footprint -* value-to-mpn: mapping from value to MPN, for components not found at - seller -* digikey-footprint-mapping: mappings from digikey's footprint names - to normalized form - -# Directory structure - - $dataset-base-dir/$data-set/ - data-set.ini - $object-type/ - $key.ini - -For tasks $data-set = $task-name. diff --git a/demo/doit/.gitignore b/demo/doit/.gitignore deleted file mode 100644 index 47aa48a..0000000 --- a/demo/doit/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -gerber.zip -gerber -.doit.db -components diff --git a/demo/doit/demo-cache.lib b/demo/doit/demo-cache.lib deleted file mode 100644 index e81b633..0000000 --- a/demo/doit/demo-cache.lib +++ /dev/null @@ -1,71 +0,0 @@ -EESchema-LIBRARY Version 2.4 -#encoding utf-8 -# -# Device:Battery_Cell -# -DEF Device:Battery_Cell BT 0 0 N N 1 F N -F0 "BT" 100 100 50 H V L CNN -F1 "Device:Battery_Cell" 100 0 50 H V L CNN -F2 "" 0 60 50 V I C CNN -F3 "" 0 60 50 V I C CNN -DRAW -S -90 70 90 60 0 1 0 F -S -62 47 58 27 0 1 0 F -P 2 0 1 0 0 30 0 0 N -P 2 0 1 0 0 70 0 100 N -P 2 0 1 10 20 135 60 135 N -P 2 0 1 10 40 155 40 115 N -X + 1 0 200 100 D 50 50 1 1 P -X - 2 0 -100 100 U 50 50 1 1 P -ENDDRAW -ENDDEF -# -# Device:C -# -DEF Device:C C 0 10 N Y 1 F N -F0 "C" 25 100 50 H V L CNN -F1 "Device:C" 25 -100 50 H V L CNN -F2 "" 38 -150 50 H I C CNN -F3 "" 0 0 50 H I C CNN -$FPLIST - C_* -$ENDFPLIST -DRAW -P 2 0 1 20 -80 -30 80 -30 N -P 2 0 1 20 -80 30 80 30 N -X ~ 1 0 150 110 D 50 50 1 1 P -X ~ 2 0 -150 110 U 50 50 1 1 P -ENDDRAW -ENDDEF -# -# Device:R -# -DEF Device:R R 0 0 N Y 1 F N -F0 "R" 80 0 50 V V C CNN -F1 "Device:R" 0 0 50 V V C CNN -F2 "" -70 0 50 V I C CNN -F3 "" 0 0 50 H I C CNN -$FPLIST - R_* -$ENDFPLIST -DRAW -S -40 -100 40 100 0 1 10 N -X ~ 1 0 150 50 D 50 50 1 1 P -X ~ 2 0 -150 50 U 50 50 1 1 P -ENDDRAW -ENDDEF -# -# power:GND -# -DEF power:GND #PWR 0 0 Y Y 1 F P -F0 "#PWR" 0 -250 50 H I C CNN -F1 "power:GND" 0 -150 50 H V C CNN -F2 "" 0 0 50 H I C CNN -F3 "" 0 0 50 H I C CNN -DRAW -P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N -X GND 1 0 0 0 D 50 50 1 1 W N -ENDDRAW -ENDDEF -# -#End Library diff --git a/demo/doit/demo.kicad_pcb b/demo/doit/demo.kicad_pcb deleted file mode 100644 index fcb69aa..0000000 --- a/demo/doit/demo.kicad_pcb +++ /dev/null @@ -1,298 +0,0 @@ -(kicad_pcb (version 20171130) (host pcbnew 5.0.0-rc3+dfsg1-2) - - (general - (thickness 1.6) - (drawings 0) - (tracks 10) - (zones 0) - (modules 4) - (nets 5) - ) - - (page A4) - (layers - (0 F.Cu signal) - (31 B.Cu signal) - (32 B.Adhes user) - (33 F.Adhes user) - (34 B.Paste user) - (35 F.Paste user) - (36 B.SilkS user) - (37 F.SilkS user) - (38 B.Mask user) - (39 F.Mask user) - (40 Dwgs.User user) - (41 Cmts.User user) - (42 Eco1.User user) - (43 Eco2.User user) - (44 Edge.Cuts user) - (45 Margin user) - (46 B.CrtYd user) - (47 F.CrtYd user) - (48 B.Fab user) - (49 F.Fab user) - ) - - (setup - (last_trace_width 0.25) - (trace_clearance 0.2) - (zone_clearance 0.508) - (zone_45_only no) - (trace_min 0.2) - (segment_width 0.2) - (edge_width 0.15) - (via_size 0.8) - (via_drill 0.4) - (via_min_size 0.4) - (via_min_drill 0.3) - (uvia_size 0.3) - (uvia_drill 0.1) - (uvias_allowed no) - (uvia_min_size 0.2) - (uvia_min_drill 0.1) - (pcb_text_width 0.3) - (pcb_text_size 1.5 1.5) - (mod_edge_width 0.15) - (mod_text_size 1 1) - (mod_text_width 0.15) - (pad_size 1.524 1.524) - (pad_drill 0.762) - (pad_to_mask_clearance 0.2) - (aux_axis_origin 0 0) - (visible_elements FFFFFF7F) - (pcbplotparams - (layerselection 0x010fc_ffffffff) - (usegerberextensions false) - (usegerberattributes false) - (usegerberadvancedattributes false) - (creategerberjobfile false) - (excludeedgelayer true) - (linewidth 0.100000) - (plotframeref false) - (viasonmask false) - (mode 1) - (useauxorigin false) - (hpglpennumber 1) - (hpglpenspeed 20) - (hpglpendiameter 15.000000) - (psnegative false) - (psa4output false) - (plotreference true) - (plotvalue true) - (plotinvisibletext false) - (padsonsilk false) - (subtractmaskfromsilk false) - (outputformat 1) - (mirror false) - (drillshape 1) - (scaleselection 1) - (outputdirectory "")) - ) - - (net 0 "") - (net 1 "Net-(BT1-Pad1)") - (net 2 GND) - (net 3 "Net-(C1-Pad1)") - (net 4 "Net-(R1-Pad1)") - - (net_class Default "This is the default net class." - (clearance 0.2) - (trace_width 0.25) - (via_dia 0.8) - (via_drill 0.4) - (uvia_dia 0.3) - (uvia_drill 0.1) - (add_net GND) - (add_net "Net-(BT1-Pad1)") - (add_net "Net-(C1-Pad1)") - (add_net "Net-(R1-Pad1)") - ) - - (module Battery:BatteryHolder_MPD_BC2AAPC_2xAA (layer F.Cu) (tedit 5AC8F8F7) (tstamp 5B5BC36D) - (at 71.75 60.5) - (descr "2xAA cell battery holder, Memory Protection Devices P/N BC2AAPC, http://www.memoryprotectiondevices.com/datasheets/BC2AAPC-datasheet.pdf") - (tags "AA battery cell holder") - (path /5B431438) - (fp_text reference BT1 (at 26.16 -10.11) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 9V (at 26.16 23.39) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -2.84 -8.61) (end -2.84 21.89) (layer F.Fab) (width 0.1)) - (fp_line (start -2.84 21.89) (end 55.16 21.89) (layer F.Fab) (width 0.1)) - (fp_line (start 55.16 21.89) (end 55.16 -8.61) (layer F.Fab) (width 0.1)) - (fp_line (start 55.16 -8.61) (end -2.84 -8.61) (layer F.Fab) (width 0.1)) - (fp_line (start -2.94 -8.71) (end -2.94 21.99) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.94 21.99) (end 55.26 21.99) (layer F.SilkS) (width 0.12)) - (fp_line (start 55.26 21.99) (end 55.26 -8.71) (layer F.SilkS) (width 0.12)) - (fp_line (start 55.26 -8.71) (end -2.94 -8.71) (layer F.SilkS) (width 0.12)) - (fp_line (start -3.34 -9.11) (end -3.34 22.39) (layer F.CrtYd) (width 0.05)) - (fp_line (start -3.34 22.39) (end 55.66 22.39) (layer F.CrtYd) (width 0.05)) - (fp_line (start 55.66 22.39) (end 55.66 -9.11) (layer F.CrtYd) (width 0.05)) - (fp_line (start 55.66 -9.11) (end -3.34 -9.11) (layer F.CrtYd) (width 0.05)) - (fp_line (start 35.685 2.54) (end 17.905 2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 2.54) (end 17.905 1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 1.27) (end 16.635 1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 1.27) (end 16.635 -1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 -1.27) (end 17.905 -1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 -1.27) (end 17.905 -2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 -2.54) (end 35.685 -2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 -2.54) (end 35.685 2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 16.13) (end 34.415 16.13) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 16.13) (end 34.415 14.86) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 14.86) (end 35.685 14.86) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 14.86) (end 35.685 12.32) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 12.32) (end 34.415 12.32) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 12.32) (end 34.415 11.05) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 11.05) (end 16.635 11.05) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 11.05) (end 16.635 16.13) (layer F.SilkS) (width 0.12)) - (fp_text user %R (at 26.16 6.63) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user - (at 36.955 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at 15.365 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user - (at 15.365 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at 36.955 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at -4.34 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user - (at -4.34 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (pad 1 thru_hole rect (at 0 0) (size 2.17 2.17) (drill 1.17) (layers *.Cu *.Mask) - (net 1 "Net-(BT1-Pad1)")) - (pad 2 thru_hole circle (at 0 13.59) (size 2.17 2.17) (drill 1.17) (layers *.Cu *.Mask) - (net 2 GND)) - (pad "" np_thru_hole circle (at 26.16 6.63) (size 3.65 3.65) (drill 3.65) (layers *.Cu *.Mask)) - (model ${KISYS3DMOD}/Battery.3dshapes/BatteryHolder_MPD_BC2AAPC_2xAA.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Resistor_SMD:R_1206_3216Metric (layer F.Cu) (tedit 5B20DC38) (tstamp 5B5BC1DF) - (at 60 61.4 90) - (descr "Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf), generated with kicad-footprint-generator") - (tags resistor) - (path /5B431328) - (attr smd) - (fp_text reference R1 (at 0 -1.82 90) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 10k (at 0 1.82 90) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -1.6 0.8) (end -1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -1.6 -0.8) (end 1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 -0.8) (end 1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 0.8) (end -1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -0.602064 -0.91) (end 0.602064 -0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.602064 0.91) (end 0.602064 0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.28 1.12) (end -2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.28 -1.12) (end 2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 -1.12) (end 2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 1.12) (end -2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_text user %R (at 0 0 90) (layer F.Fab) - (effects (font (size 0.8 0.8) (thickness 0.12))) - ) - (pad 1 smd roundrect (at -1.4 0 90) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 4 "Net-(R1-Pad1)")) - (pad 2 smd roundrect (at 1.4 0 90) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 1 "Net-(BT1-Pad1)")) - (model ${KISYS3DMOD}/Resistor_SMD.3dshapes/R_1206_3216Metric.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Capacitor_THT:CP_Radial_Tantal_D10.5mm_P5.00mm (layer F.Cu) (tedit 5AE50EF0) (tstamp 5B5D0FE8) - (at 51.25 76) - (descr "CP, Radial_Tantal series, Radial, pin pitch=5.00mm, , diameter=10.5mm, Tantal Electrolytic Capacitor, http://cdn-reichelt.de/documents/datenblatt/B300/TANTAL-TB-Serie%23.pdf") - (tags "CP Radial_Tantal series Radial pin pitch 5.00mm diameter 10.5mm Tantal Electrolytic Capacitor") - (path /5B4314AB) - (fp_text reference C1 (at 2.5 -6.5) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 1u (at 2.5 6.5) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_circle (center 2.5 0) (end 7.75 0) (layer F.Fab) (width 0.1)) - (fp_circle (center 2.5 0) (end 7.87 0) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.5 0) (end 8 0) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.004387 -2.2975) (end -0.954387 -2.2975) (layer F.Fab) (width 0.1)) - (fp_line (start -1.479387 -2.8225) (end -1.479387 -1.7725) (layer F.Fab) (width 0.1)) - (fp_line (start -3.247133 -3.015) (end -2.197133 -3.015) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.722133 -3.54) (end -2.722133 -2.49) (layer F.SilkS) (width 0.12)) - (fp_text user %R (at 2.5 0) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (pad 1 thru_hole rect (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) - (net 3 "Net-(C1-Pad1)")) - (pad 2 thru_hole circle (at 5 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) - (net 2 GND)) - (model ${KISYS3DMOD}/Capacitor_THT.3dshapes/CP_Radial_Tantal_D10.5mm_P5.00mm.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Resistor_SMD:R_1206_3216Metric (layer F.Cu) (tedit 5B20DC38) (tstamp 5B5D10B5) - (at 58.75 66.5) - (descr "Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf), generated with kicad-footprint-generator") - (tags resistor) - (path /5B5CC4D4) - (attr smd) - (fp_text reference R2 (at 0 -1.82) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 10k (at 0 1.82) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -1.6 0.8) (end -1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -1.6 -0.8) (end 1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 -0.8) (end 1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 0.8) (end -1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -0.602064 -0.91) (end 0.602064 -0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.602064 0.91) (end 0.602064 0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.28 1.12) (end -2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.28 -1.12) (end 2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 -1.12) (end 2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 1.12) (end -2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_text user %R (at 0 0) (layer F.Fab) - (effects (font (size 0.8 0.8) (thickness 0.12))) - ) - (pad 1 smd roundrect (at -1.4 0) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 3 "Net-(C1-Pad1)")) - (pad 2 smd roundrect (at 1.4 0) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 4 "Net-(R1-Pad1)")) - (model ${KISYS3DMOD}/Resistor_SMD.3dshapes/R_1206_3216Metric.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (segment (start 71.25 60) (end 71.75 60.5) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 60 60) (end 71.25 60) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 62.91 74.09) (end 61 76) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 71.75 74.09) (end 62.91 74.09) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 56.25 76) (end 61 76) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 53.25 66.5) (end 51.25 68.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 57.35 66.5) (end 53.25 66.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 51.25 76) (end 51.25 68.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 60 66.35) (end 60.15 66.5) (width 0.25) (layer F.Cu) (net 4)) - (segment (start 60 62.8) (end 60 66.35) (width 0.25) (layer F.Cu) (net 4)) - -) diff --git a/demo/doit/demo.pro b/demo/doit/demo.pro deleted file mode 100644 index 152769c..0000000 --- a/demo/doit/demo.pro +++ /dev/null @@ -1,33 +0,0 @@ -update=22/05/2015 07:44:53 -version=1 -last_client=kicad -[general] -version=1 -RootSch= -BoardNm= -[pcbnew] -version=1 -LastNetListRead= -UseCmpFile=1 -PadDrill=0.600000000000 -PadDrillOvalY=0.600000000000 -PadSizeH=1.500000000000 -PadSizeV=1.500000000000 -PcbTextSizeV=1.500000000000 -PcbTextSizeH=1.500000000000 -PcbTextThickness=0.300000000000 -ModuleTextSizeV=1.000000000000 -ModuleTextSizeH=1.000000000000 -ModuleTextSizeThickness=0.150000000000 -SolderMaskClearance=0.000000000000 -SolderMaskMinWidth=0.000000000000 -DrawSegmentWidth=0.200000000000 -BoardOutlineThickness=0.100000000000 -ModuleOutlineThickness=0.150000000000 -[cvpcb] -version=1 -NetIExt=net -[eeschema] -version=1 -LibDir= -[eeschema/libraries] diff --git a/demo/doit/demo.sch b/demo/doit/demo.sch deleted file mode 100644 index 37a2ff9..0000000 --- a/demo/doit/demo.sch +++ /dev/null @@ -1,95 +0,0 @@ -EESchema Schematic File Version 4 -LIBS:demo-cache -EELAYER 26 0 -EELAYER END -$Descr A4 11693 8268 -encoding utf-8 -Sheet 1 1 -Title "" -Date "" -Rev "" -Comp "" -Comment1 "" -Comment2 "" -Comment3 "" -Comment4 "" -$EndDescr -$Comp -L Device:R R1 -U 1 1 5B431328 -P 4150 2600 -F 0 "R1" V 3943 2600 50 0000 C CNN -F 1 "10k" V 4034 2600 50 0000 C CNN -F 2 "Resistor_SMD:R_1206_3216Metric" V 4080 2600 50 0001 C CNN -F 3 "~" H 4150 2600 50 0001 C CNN -F 4 "RMCF1206JT10K0" V 4150 2600 50 0001 C CNN "mpn" - 1 4150 2600 - 0 1 1 0 -$EndComp -$Comp -L Device:Battery_Cell BT1 -U 1 1 5B431438 -P 3700 2900 -F 0 "BT1" H 3818 2996 50 0000 L CNN -F 1 "9V" H 3818 2905 50 0000 L CNN -F 2 "Battery:BatteryHolder_MPD_BC2AAPC_2xAA" V 3700 2960 50 0001 C CNN -F 3 "~" V 3700 2960 50 0001 C CNN -F 4 "BC2AAPC" H 3700 2900 50 0001 C CNN "mpn" - 1 3700 2900 - 1 0 0 -1 -$EndComp -$Comp -L Device:C C1 -U 1 1 5B4314AB -P 5100 2850 -F 0 "C1" H 5215 2896 50 0000 L CNN -F 1 "1u" H 5215 2805 50 0000 L CNN -F 2 "Capacitor_THT:CP_Radial_Tantal_D10.5mm_P5.00mm" H 5138 2700 50 0001 C CNN -F 3 "~" H 5100 2850 50 0001 C CNN -F 4 "UCA2G100MPD1TD" H 5100 2850 50 0001 C CNN "mpn" - 1 5100 2850 - 1 0 0 -1 -$EndComp -Wire Wire Line - 3700 3000 3700 3100 -Wire Wire Line - 5100 3100 5100 3000 -$Comp -L power:GND #PWR0101 -U 1 1 5B4315FE -P 3700 3200 -F 0 "#PWR0101" H 3700 2950 50 0001 C CNN -F 1 "GND" H 3705 3027 50 0000 C CNN -F 2 "" H 3700 3200 50 0001 C CNN -F 3 "" H 3700 3200 50 0001 C CNN - 1 3700 3200 - 1 0 0 -1 -$EndComp -Wire Wire Line - 3700 3200 3700 3100 -Connection ~ 3700 3100 -Wire Wire Line - 3700 2700 3700 2600 -Wire Wire Line - 5100 2600 5100 2700 -Wire Wire Line - 3700 2600 4000 2600 -Wire Wire Line - 3700 3100 5100 3100 -Wire Wire Line - 4300 2600 4500 2600 -$Comp -L Device:R R2 -U 1 1 5B5CC4D4 -P 4650 2600 -F 0 "R2" V 4443 2600 50 0000 C CNN -F 1 "10k" V 4534 2600 50 0000 C CNN -F 2 "Resistor_SMD:R_1206_3216Metric" V 4580 2600 50 0001 C CNN -F 3 "~" H 4650 2600 50 0001 C CNN -F 4 "RMCF1206JT10K0" V 4650 2600 50 0001 C CNN "mpn" - 1 4650 2600 - 0 1 1 0 -$EndComp -Wire Wire Line - 4800 2600 5100 2600 -$EndSCHEMATC diff --git a/demo/doit/docs/.gitignore b/demo/doit/docs/.gitignore deleted file mode 100644 index e35d885..0000000 --- a/demo/doit/docs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_build diff --git a/demo/doit/docs/Makefile b/demo/doit/docs/Makefile deleted file mode 100644 index a7ef341..0000000 --- a/demo/doit/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXPROJ = Demo -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file diff --git a/demo/doit/docs/conf.py b/demo/doit/docs/conf.py deleted file mode 100644 index 4c45eca..0000000 --- a/demo/doit/docs/conf.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Configuration file for the Sphinx documentation builder. -# -# This file does only contain a selection of the most common options. For a -# full list see the documentation: -# http://www.sphinx-doc.org/en/master/config - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'Demo' -copyright = '2018, Demo' -author = 'Demo' - -# The short X.Y version -version = '' -# The full version, including alpha/beta/rc tags -release = '' - - -# -- General configuration --------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path . -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# The default sidebars (for documents that don't match any pattern) are -# defined by theme itself. Builtin themes are using these templates by -# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', -# 'searchbox.html']``. -# -# html_sidebars = {} - - -# -- Options for HTMLHelp output --------------------------------------------- - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Demodoc' - - -# -- Options for LaTeX output ------------------------------------------------ - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'Demo.tex', 'Demo Documentation', - 'Demo', 'manual'), -] - - -# -- Options for manual page output ------------------------------------------ - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'demo', 'Demo Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ---------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'Demo', 'Demo Documentation', - author, 'Demo', 'One line description of project.', - 'Miscellaneous'), -]
\ No newline at end of file diff --git a/demo/doit/docs/index.rst b/demo/doit/docs/index.rst deleted file mode 100644 index 437a1e5..0000000 --- a/demo/doit/docs/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. Demo documentation master file, created by - sphinx-quickstart on Sun Aug 5 12:49:19 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to Demo's documentation! -================================ - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - :numbered: - - report/index - report/messages - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/demo/doit/docs/make.bat b/demo/doit/docs/make.bat deleted file mode 100644 index f8072c5..0000000 --- a/demo/doit/docs/make.bat +++ /dev/null @@ -1,36 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ=Demo - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/demo/doit/docs/report/index.rst b/demo/doit/docs/report/index.rst deleted file mode 100644 index e49d09e..0000000 --- a/demo/doit/docs/report/index.rst +++ /dev/null @@ -1,4 +0,0 @@ -Reports -======= - -* :doc:`messages`
\ No newline at end of file diff --git a/demo/doit/docs/report/messages.rst b/demo/doit/docs/report/messages.rst deleted file mode 100644 index 25bc464..0000000 --- a/demo/doit/docs/report/messages.rst +++ /dev/null @@ -1,5 +0,0 @@ -Messages -======== - -There are 0 messages. - diff --git a/demo/doit/dodo.py b/demo/doit/dodo.py deleted file mode 100644 index a9dca5c..0000000 --- a/demo/doit/dodo.py +++ /dev/null @@ -1,74 +0,0 @@ -from ee.bom.doit import * -from ee.digikey.doit import * -from ee.doit import configure_logging, ReportCollection -from ee.ds import DataSetManager -from ee.kicad.doit import * -# noinspection PyUnresolvedReferences -from ee.report.doit import * - - -def configure_kicad(): - from ee.kicad.doit import doit_config, init - doit_config.configure(data_set_manager=dsm) - doit_config.append_in_data_set_for_task(task_kicad_create_component_data_set, kicad_footprint) - init(sch=sch, kicad_pcb=kicad_pcb, gerber_dir="gerber", ) - - -def configure_bom(): - from ee.bom.doit import doit_config - doit_config.configure(data_set_manager=dsm) - - -def configure_digikey(): - from ee.digikey.doit import doit_config - doit_config.configure(data_set_manager=dsm) - - -def configure_report(): - from ee.report.doit import doit_config - doit_config.configure(data_set_manager=dsm, report_collection=report_collection, extra_config=extra_config) - - -configure_logging() -DOIT_CONFIG = {'check_file_uptodate': 'timestamp'} - -prj = "demo" -sch = "{}.sch".format(prj) -kicad_pcb = "{}.kicad_pcb".format(prj) - -extra_config = dict(report_dir="docs/report") - -dsm = DataSetManager("ee") -report_collection = ReportCollection() - -kicad_footprint = "kicad-footprint" -dsm.register_ds("csv", kicad_footprint, "kicad-footprint-mapping", path="ee/kicad-footprint.csv") - -configure_kicad() -configure_bom() -configure_digikey() -configure_report() - - -def task_orders(): - import ee.bom.doit - import ee.digikey.doit - - bom_cfg = ee.bom.doit.doit_config - digikey_cfg = ee.digikey.doit.doit_config - - data_sets = [bom_cfg.out_data_set_for(task_bom), - digikey_cfg.out_data_set_for(task_digikey_resolve_schematic_components)] - - yield create_task_order_csv( - output_file="ee/order.csv", - out_data_set="order", - data_sets=data_sets) - - for size in [1, 100]: - yield create_task_order_csv( - output_file="ee/digikey-{}.csv".format(size) if size != 1 else "ee/digikey.csv", - style="digikey", - out_data_set="digikey-order-{}".format(size), - data_sets=data_sets, - count=size) diff --git a/demo/doit/ee/bom/bom-component/BT1.ini b/demo/doit/ee/bom/bom-component/BT1.ini deleted file mode 100644 index b65c2f0..0000000 --- a/demo/doit/ee/bom/bom-component/BT1.ini +++ /dev/null @@ -1,7 +0,0 @@ -[meta] -type = bom-component - -[values] -ref = BT1 -mpn = BC2AAPC - diff --git a/demo/doit/ee/bom/bom-component/C1.ini b/demo/doit/ee/bom/bom-component/C1.ini deleted file mode 100644 index ceee93c..0000000 --- a/demo/doit/ee/bom/bom-component/C1.ini +++ /dev/null @@ -1,7 +0,0 @@ -[meta] -type = bom-component - -[values] -ref = C1 -mpn = UCA2G100MPD1TD - diff --git a/demo/doit/ee/bom/bom-component/R1.ini b/demo/doit/ee/bom/bom-component/R1.ini deleted file mode 100644 index f76332b..0000000 --- a/demo/doit/ee/bom/bom-component/R1.ini +++ /dev/null @@ -1,7 +0,0 @@ -[meta] -type = bom-component - -[values] -ref = R1 -mpn = RMCF1206JT10K0 - diff --git a/demo/doit/ee/bom/bom-component/R2.ini b/demo/doit/ee/bom/bom-component/R2.ini deleted file mode 100644 index 301daa1..0000000 --- a/demo/doit/ee/bom/bom-component/R2.ini +++ /dev/null @@ -1,7 +0,0 @@ -[meta] -type = bom-component - -[values] -ref = R2 -mpn = RMCF1206JT10K0 - diff --git a/demo/doit/ee/bom/data-set.ini b/demo/doit/ee/bom/data-set.ini deleted file mode 100644 index e915b00..0000000 --- a/demo/doit/ee/bom/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = bom - diff --git a/demo/doit/ee/digikey-100.csv b/demo/doit/ee/digikey-100.csv deleted file mode 100644 index 4bf730c..0000000 --- a/demo/doit/ee/digikey-100.csv +++ /dev/null @@ -1,4 +0,0 @@ -Digi-Key Part Number,Customer Reference,Quantity,MPN -BC2AAPC-ND,BT1,100,BC2AAPC -RMCF1206JT10K0CT-ND,"R2,R1",200,RMCF1206JT10K0 -493-4771-1-ND,C1,100,UCA2G100MPD1TD diff --git a/demo/doit/ee/digikey-order-1/data-set.ini b/demo/doit/ee/digikey-order-1/data-set.ini deleted file mode 100644 index 4370e67..0000000 --- a/demo/doit/ee/digikey-order-1/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = digikey-order-1 - diff --git a/demo/doit/ee/digikey-order-100/data-set.ini b/demo/doit/ee/digikey-order-100/data-set.ini deleted file mode 100644 index 342fa29..0000000 --- a/demo/doit/ee/digikey-order-100/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = digikey-order-100 - diff --git a/demo/doit/ee/digikey-parts/data-set.ini b/demo/doit/ee/digikey-parts/data-set.ini deleted file mode 100644 index 156b0ff..0000000 --- a/demo/doit/ee/digikey-parts/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = digikey-parts - diff --git a/demo/doit/ee/digikey-parts/digikey-part/493-4771-1-ND.ini b/demo/doit/ee/digikey-parts/digikey-part/493-4771-1-ND.ini deleted file mode 100644 index e4b36c3..0000000 --- a/demo/doit/ee/digikey-parts/digikey-part/493-4771-1-ND.ini +++ /dev/null @@ -1,27 +0,0 @@ -[meta] -type = digikey-part - -[values] -part-number = 493-4771-1-ND -url = https://www.digikey.com/product-detail/en/nichicon/UCA2G100MPD1TD/493-4771-1-ND/3129112 -mpn = UCA2G100MPD1TD -7/Packaging = Cut Tape (CT) -1989/Part Status = Active -2049/Capacitance = 10µF -3/Tolerance = ±20% -2079/Voltage - Rated = 400V -724/ESR (Equivalent Series Resistance) = - -725/Lifetime @ Temp. = 10000 Hrs @ 105°C -252/Operating Temperature = -25°C ~ 105°C -52/Polarization = - -707/Ratings = - -405/Applications = General Purpose -2253/Ripple Current @ Low Frequency = 140mA @ 120Hz -2260/Ripple Current @ High Frequency = 280mA @ 100kHz -508/Lead Spacing = 0.197" (5.00mm) -46/Size / Dimension = 0.394" Dia (10.00mm) -1500/Height - Seated (Max) = 0.846" (21.50mm) -884/Surface Mount Land Size = - -69/Mounting Type = Through Hole -16/Package / Case = Radial, Can - diff --git a/demo/doit/ee/digikey-parts/digikey-part/BC2AAPC-ND.ini b/demo/doit/ee/digikey-parts/digikey-part/BC2AAPC-ND.ini deleted file mode 100644 index b919629..0000000 --- a/demo/doit/ee/digikey-parts/digikey-part/BC2AAPC-ND.ini +++ /dev/null @@ -1,18 +0,0 @@ -[meta] -type = digikey-part - -[values] -part-number = BC2AAPC-ND -url = https://www.digikey.com/product-detail/en/mpd-memory-protection-devices/BC2AAPC/BC2AAPC-ND/455777 -mpn = BC2AAPC -1989/Part Status = Active -252/Operating Temperature = -10°C ~ 100°C -69/Mounting Type = PCB, Through Hole -1445/Battery Type, Function = Cylindrical, Holder -91/Style = Holder (Open) -32/Battery Cell Size = AA -36/Number of Cells = 2 -1142/Battery Series = - -258/Termination Style = PC Pin -759/Height Above Board = 0.591" (15.01mm) - diff --git a/demo/doit/ee/digikey-parts/digikey-part/RMCF1206JT10K0CT-ND.ini b/demo/doit/ee/digikey-parts/digikey-part/RMCF1206JT10K0CT-ND.ini deleted file mode 100644 index 48af2b7..0000000 --- a/demo/doit/ee/digikey-parts/digikey-part/RMCF1206JT10K0CT-ND.ini +++ /dev/null @@ -1,23 +0,0 @@ -[meta] -type = digikey-part - -[values] -part-number = RMCF1206JT10K0CT-ND -url = https://www.digikey.com/product-detail/en/stackpole-electronics-inc/RMCF1206JT10K0/RMCF1206JT10K0CT-ND/1942803 -mpn = RMCF1206JT10K0 -7/Packaging = Cut Tape (CT) -1989/Part Status = Active -3/Tolerance = ±5% -252/Operating Temperature = -55°C ~ 155°C -46/Size / Dimension = 0.126" L x 0.063" W (3.20mm x 1.60mm) -1500/Height - Seated (Max) = 0.028" (0.70mm) -16/Package / Case = 1206 (3216 Metric) -2085/Resistance = 10 kOhms -2/Power (Watts) = 0.25W, 1/4W -174/Composition = Thick Film -5/Features = Automotive AEC-Q200 -17/Temperature Coefficient = ±200ppm/°C -1291/Supplier Device Package = 1206 -1127/Number of Terminations = 2 -1531/Failure Rate = - - diff --git a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-BT1-BC2AAPC-ND.ini b/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-BT1-BC2AAPC-ND.ini deleted file mode 100644 index bc3e7d7..0000000 --- a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-BT1-BC2AAPC-ND.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -type = component-to-part-mapping - -[values] -seller = digikey -ref = BT1 -part-number = BC2AAPC-ND -mpn = BC2AAPC -description = ONBOARD SMD 868/915 -url = https://www.digikey.com/product-detail/en/mpd-memory-protection-devices/BC2AAPC/BC2AAPC-ND/455777 - diff --git a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-C1-493-4771-1-ND.ini b/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-C1-493-4771-1-ND.ini deleted file mode 100644 index 2c67cd2..0000000 --- a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-C1-493-4771-1-ND.ini +++ /dev/null @@ -1,10 +0,0 @@ -[meta] -type = component-to-part-mapping - -[values] -seller = digikey -ref = C1 -part-number = 493-4771-1-ND -mpn = UCA2G100MPD1TD -url = /product-detail/en/nichicon/UCA2G100MPD1TD/493-4771-1-ND/3129112 - diff --git a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R1-RMCF1206JT10K0CT-ND.ini b/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R1-RMCF1206JT10K0CT-ND.ini deleted file mode 100644 index c3fa7d2..0000000 --- a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R1-RMCF1206JT10K0CT-ND.ini +++ /dev/null @@ -1,10 +0,0 @@ -[meta] -type = component-to-part-mapping - -[values] -seller = digikey -ref = R1 -part-number = RMCF1206JT10K0CT-ND -mpn = RMCF1206JT10K0 -url = /product-detail/en/stackpole-electronics-inc/RMCF1206JT10K0/RMCF1206JT10K0CT-ND/1942803 - diff --git a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R2-RMCF1206JT10K0CT-ND.ini b/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R2-RMCF1206JT10K0CT-ND.ini deleted file mode 100644 index 8013cac..0000000 --- a/demo/doit/ee/digikey-resolved-parts/component-to-part-mapping/digikey-R2-RMCF1206JT10K0CT-ND.ini +++ /dev/null @@ -1,10 +0,0 @@ -[meta] -type = component-to-part-mapping - -[values] -seller = digikey -ref = R2 -part-number = RMCF1206JT10K0CT-ND -mpn = RMCF1206JT10K0 -url = /product-detail/en/stackpole-electronics-inc/RMCF1206JT10K0/RMCF1206JT10K0CT-ND/1942803 - diff --git a/demo/doit/ee/digikey-resolved-parts/data-set.ini b/demo/doit/ee/digikey-resolved-parts/data-set.ini deleted file mode 100644 index 870a079..0000000 --- a/demo/doit/ee/digikey-resolved-parts/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = digikey-resolved-parts - diff --git a/demo/doit/ee/digikey.csv b/demo/doit/ee/digikey.csv deleted file mode 100644 index ea71d42..0000000 --- a/demo/doit/ee/digikey.csv +++ /dev/null @@ -1,4 +0,0 @@ -Digi-Key Part Number,Customer Reference,Quantity,MPN -BC2AAPC-ND,BT1,1,BC2AAPC -RMCF1206JT10K0CT-ND,"R2,R1",2,RMCF1206JT10K0 -493-4771-1-ND,C1,1,UCA2G100MPD1TD diff --git a/demo/doit/ee/kicad-footprint.csv b/demo/doit/ee/kicad-footprint.csv deleted file mode 100644 index a9ccfd7..0000000 --- a/demo/doit/ee/kicad-footprint.csv +++ /dev/null @@ -1,2 +0,0 @@ -kicad,common -Resistor_SMD:R_1206_3216Metric,SMD_3216 diff --git a/demo/doit/ee/kicad-pcb/data-set.ini b/demo/doit/ee/kicad-pcb/data-set.ini deleted file mode 100644 index 7229def..0000000 --- a/demo/doit/ee/kicad-pcb/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = kicad-pcb - diff --git a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC1DF.ini b/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC1DF.ini deleted file mode 100644 index bffc18c..0000000 --- a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC1DF.ini +++ /dev/null @@ -1,10 +0,0 @@ -[meta] -type = kicad-pcb-component - -[values] -ref = R1 -placement-x = 60.0 -placement-y = 61.4 -placement-rotation = 90.0 -layer = F.Cu - diff --git a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC36D.ini b/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC36D.ini deleted file mode 100644 index 42cab19..0000000 --- a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5BC36D.ini +++ /dev/null @@ -1,9 +0,0 @@ -[meta] -type = kicad-pcb-component - -[values] -ref = BT1 -placement-x = 71.75 -placement-y = 60.5 -layer = F.Cu - diff --git a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D0FE8.ini b/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D0FE8.ini deleted file mode 100644 index 41df177..0000000 --- a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D0FE8.ini +++ /dev/null @@ -1,9 +0,0 @@ -[meta] -type = kicad-pcb-component - -[values] -ref = C1 -placement-x = 51.25 -placement-y = 76.0 -layer = F.Cu - diff --git a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D10B5.ini b/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D10B5.ini deleted file mode 100644 index 4e39ba0..0000000 --- a/demo/doit/ee/kicad-pcb/kicad-pcb-component/5B5D10B5.ini +++ /dev/null @@ -1,9 +0,0 @@ -[meta] -type = kicad-pcb-component - -[values] -ref = R2 -placement-x = 58.75 -placement-y = 66.5 -layer = F.Cu - diff --git a/demo/doit/ee/kicad-sch/data-set.ini b/demo/doit/ee/kicad-sch/data-set.ini deleted file mode 100644 index 23c66c7..0000000 --- a/demo/doit/ee/kicad-sch/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = kicad-sch - diff --git a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431328.ini b/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431328.ini deleted file mode 100644 index 5bec452..0000000 --- a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431328.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -type = kicad-schematic-component - -[values] -ref = R1 -ref-type = R -ref-num = 1 -value = 10k -footprint = Resistor_SMD:R_1206_3216Metric -field-mpn = RMCF1206JT10K0 - diff --git a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431438.ini b/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431438.ini deleted file mode 100644 index aa748e4..0000000 --- a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B431438.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -type = kicad-schematic-component - -[values] -ref = BT1 -ref-type = BT -ref-num = 1 -value = 9V -footprint = Battery:BatteryHolder_MPD_BC2AAPC_2xAA -field-mpn = BC2AAPC - diff --git a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4314AB.ini b/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4314AB.ini deleted file mode 100644 index 30f9a91..0000000 --- a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4314AB.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -type = kicad-schematic-component - -[values] -ref = C1 -ref-type = C -ref-num = 1 -value = 1u -footprint = Capacitor_THT:CP_Radial_Tantal_D10.5mm_P5.00mm -field-mpn = UCA2G100MPD1TD - diff --git a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4315FE.ini b/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4315FE.ini deleted file mode 100644 index 5896e1c..0000000 --- a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B4315FE.ini +++ /dev/null @@ -1,9 +0,0 @@ -[meta] -type = kicad-schematic-component - -[values] -ref = #PWR0101 -ref-type = #PWR -ref-num = 101 -value = GND - diff --git a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B5CC4D4.ini b/demo/doit/ee/kicad-sch/kicad-schematic-component/5B5CC4D4.ini deleted file mode 100644 index 65ed524..0000000 --- a/demo/doit/ee/kicad-sch/kicad-schematic-component/5B5CC4D4.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -type = kicad-schematic-component - -[values] -ref = R2 -ref-type = R -ref-num = 2 -value = 10k -footprint = Resistor_SMD:R_1206_3216Metric -field-mpn = RMCF1206JT10K0 - diff --git a/demo/doit/ee/order.csv b/demo/doit/ee/order.csv deleted file mode 100644 index 9722390..0000000 --- a/demo/doit/ee/order.csv +++ /dev/null @@ -1,4 +0,0 @@ -MPN,Count,References -BC2AAPC,1,BT1 -RMCF1206JT10K0,2,"R2,R1" -UCA2G100MPD1TD,1,C1 diff --git a/demo/doit/ee/order/data-set.ini b/demo/doit/ee/order/data-set.ini deleted file mode 100644 index 724aea2..0000000 --- a/demo/doit/ee/order/data-set.ini +++ /dev/null @@ -1,3 +0,0 @@ -[data-set] -name = order - diff --git a/docs/getting-started-dodo.rst b/docs/getting-started-dodo.rst deleted file mode 100644 index 649043f..0000000 --- a/docs/getting-started-dodo.rst +++ /dev/null @@ -1,6 +0,0 @@ -:orphan: - -Example dodo.py ---------------- - -.. literalinclude:: ../demo/doit/dodo.py diff --git a/docs/getting-started.rst b/docs/getting-started.rst index aeb023d..48b1a0d 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -11,7 +11,3 @@ In the directory where you have your KiCAD project, run:: EOF env/bin/pip install -r requirements -Then we need to configure DoIt. DoIt is somewhat like make, with tasks (code to run), file dependencies (input files) -and targets (output files). The exact - -See :doc:`getting-started-dodo` diff --git a/docs/index.rst b/docs/index.rst index 212eb9d..fca6d9b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,9 +3,6 @@ EE Tools The ``ee`` project's main goals is to make it to automate and increase the quality of electronics engineering projects. -The implementation 1) a bunch of Python code to work with EE-related programs and file formats and 2) a bunch of -`DoIt <http://pydoit.org>`_ tasks. - Currently the project support these tools: * `KiCAD <http://kicad.org>`_ diff --git a/requirements.txt b/requirements.txt index a389f3a..b9d58f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,4 +21,3 @@ requests==2.21.0 # for development jupyter==1.0.0 -doit==0.30.3 diff --git a/src/ee/bom/__init__.py b/src/ee/bom/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/src/ee/bom/__init__.py +++ /dev/null diff --git a/src/ee/bom/doit.py b/src/ee/bom/doit.py deleted file mode 100644 index bf6975b..0000000 --- a/src/ee/bom/doit.py +++ /dev/null @@ -1,179 +0,0 @@ -import logging -from pathlib import Path -from typing import Union - -from namedlist import namedlist - -from ee.doit import DoItConfig -from ee.ds import DataSet, create_message - -logger = logging.getLogger(__name__) - -doit_config = DoItConfig() - - -class BomComponent(object): - def __init__(self, ref, mpn): - self.ref = ref - self.mpn = mpn - - def to_object(self, ds): - return ds.create_object("bom-component", self.ref). \ - set("ref", self.ref). \ - set("mpn", self.mpn) - - -def task_bom(): - """ - Creates 'bom-component' from 'component'. - - Takes all schematic components, filters out all virtual/non- - physical components (like power flags and ground components) and - creates 'bom-component' objects. - """ - - out_data_set, in_data_sets = doit_config.data_sets_for(task_bom) - - def action(): - in_ds = doit_config.dsm.load_data_sets(in_data_sets) - - with doit_config.dsm.create_rw(out_data_set, clean=True) as output: - components = [o for o in in_ds.items() if o.object_type.name == "component"] - - bom_components = {} - - for c in components: - ref = c.get("ref") - mpn = c.get("mpn") - - if not ref: - raise Exception("Missing ref") - - if not mpn: - create_message(output, "Missing required field 'mpn' on component ref={}".format(ref), "error") - continue - - if ref in bom_components: - raise Exception("Duplicate ref '{}'".format("ref")) - - bom_components[ref] = BomComponent(ref, mpn) - - [c.to_object(output) for c in bom_components.values()] - - return { - "file_dep": [doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - "actions": [action], - "targets": [doit_config.dsm.cookie_for_ds(out_data_set)], - } - - -doit_config.set_data_sets_for(task_bom, "bom", "components") - - -def order_csv(count: int, style: str, output_file: Path, out_ds: DataSet, data_sets): - ds = doit_config.dsm.load_data_sets(data_sets) - - csv_ds = DataSet() - - parts = {} - - # noinspection PyPep8Naming - Part = namedlist("Part", "mpn, cnt, refs, digikey_pn") - - digikey_parts = [o for o in ds.items() if - o.object_type.name == "component-to-part-mapping" and - o.get("seller") == "digikey"] - - for c in [o for o in ds.items() if o.object_type.name == "bom-component"]: - ref = c.get("ref") - mpn = c.get("mpn") - - digikey_pn = None - - if style == "digikey": - - digikey_pns = [] - for o in (o for o in digikey_parts if o.get("ref") == ref): - - t = o.values("part-number", strip=True, required=True) - - if not t: - create_message(out_ds, "Missing required field value for field part-number, object key={}". - format(o.key), level="error") - - part_number = t[0] - - digikey_pns.append(part_number) - - # The actual DK part should depend on the price breaks for the different packagings, but we don't have that - # info here. Luckily the DK store proposes cheaper packagings when ordering so that is something. - - digikey_pns = set(digikey_pns) - - if len(digikey_pns) == 0: - create_message(out_ds, "No part for component: ref={}, mpn={}".format(ref, mpn), "error") - continue - elif len(digikey_pns) > 1: - create_message(out_ds, "Multiple parts for component: ref={}, mpn={}. Don't know which one to select.". - format(ref, mpn), "error") - continue - else: - digikey_pn = next(iter(digikey_pns)) - - digikey_pn = digikey_pn.strip() - - if len(digikey_pn) == 0: - raise Exception("Missing digikey part number for ref={}".format(ref)) - - if mpn in parts: - part = parts[mpn] - - if digikey_pn: - if part.digikey_pn != digikey_pn: - raise Exception("Bad data, inconsistent digikey-pn for mpn '{}'. First digikey part number='{}', " - "new digikey part number='{}'".format(mpn, part.digikey_pn, digikey_pn)) - - part.cnt += 1 - part.refs.append(ref) - else: - parts[mpn] = Part(mpn=mpn, cnt=1, refs=[ref], digikey_pn=digikey_pn) - - mpn_field = "MPN" - count_field = "Count" - refs_field = "References" - - if style == "digikey": - count_field = "Quantity" - refs_field = "Customer Reference" - - for part in sorted(parts.values(), key=lambda p: p.mpn): - o = csv_ds.create_object("row", part.mpn). \ - set(mpn_field, part.mpn). \ - set(count_field, part.cnt * count). \ - set(refs_field, ",".join(part.refs)) - - if style == "digikey": - o.set("Digi-Key Part Number", part.digikey_pn) - - fields = None - include_extra_fields = True - - if style == "digikey": - fields = ["Digi-Key Part Number", refs_field, count_field, mpn_field] - include_extra_fields = False - - doit_config.dsm.store_csv(output_file, csv_ds, "row", order_by=mpn_field, fields=fields, - include_extra_fields=include_extra_fields) - - -def create_task_order_csv(*, style: str = None, output_file: Union[str, Path], out_data_set, data_sets, count: int = 1): - def action(): - with doit_config.dsm.create_rw(out_data_set, clean=True) as out: - order_csv(count, style, Path(output_file), out, data_sets) - - return { - "name": "order-{}".format(count) if not style else "order-{}-{}".format(style, count), - "actions": [action], - "file_dep": [doit_config.dsm.cookie_for_ds(ds) for ds in data_sets], - "targets": [doit_config.dsm.cookie_for_ds(out_data_set), output_file], - } diff --git a/src/ee/digikey/doit.py b/src/ee/digikey/doit.py deleted file mode 100644 index 93963c9..0000000 --- a/src/ee/digikey/doit.py +++ /dev/null @@ -1,165 +0,0 @@ -import logging -from itertools import groupby -from operator import itemgetter -from typing import List - -import ee.digikey as dk -from ee.doit import DoItConfig -from ee.ds import DataSet - -logger = logging.getLogger(__name__) - -doit_config = DoItConfig() - - -def resolve_schematic_components(output: DataSet, in_ds: DataSet): - def find(field, value): - return [o for o in output.items() if - o.object_type.name == "component-to-part-mapping" and o.get(field) == value] - - def save(refs: List[str], p: dk.DigikeyProduct): - logger.info("Found part, dpn={}, mpn={}, refs={}".format(p.part_number, p.mpn, ", ".join(refs))) - - for ref in refs: - # Make the key a bit long so we can have several parts that matches the MPN from a single seller - key = "digikey-{}-{}".format(ref, p.part_number) - output.create_object("component-to-part-mapping", key, replace=True). \ - set("seller", "digikey"). \ - set("ref", ref). \ - set("part-number", p.part_number). \ - set("mpn", p.mpn). \ - set("description", p.description). \ - set("quantity-available", p.quantity_available). \ - set("url", p.url) - - digikey = dk.Digikey() - client = dk.DigikeyClient(digikey, on_download=logger.info) - - components = [] - - # TODO: support searching by value and digikey part number directly. Priority should be "digikey", "mpn" and - # "value", first field present should be used. - - for o in in_ds.items(): - if o.object_type.name != "component": - continue - - ref, = o.values("ref", required=True) - - if not ref: - raise Exception("Bad component: object key={}, missing required field 'ref'".format(o.key)) - - mpn, = o.values("mpn", strip=True) - - # We ignore components without mpn. - if not mpn: - logger.debug("Skipping component without MPN: {}".format(ref)) - continue - - components.append([mpn, ref]) - - components = sorted(components, key=itemgetter(0)) - - for mpn, components in groupby(components, key=itemgetter(0)): - references = [c[1] for c in components] - - dk_components = find("mpn", mpn) - - if len(dk_components): - logger.info("Already resolved {} to {}".format(mpn, ", ".join( - sorted(set([c.get("part-number") for c in dk_components]))))) - continue - - logger.info("Looking up MPN: {}, used by {}".format(mpn, ", ".join(sorted(references)))) - response = client.search(mpn) - - if response.response_type == dk.SearchResponseTypes.SINGLE: - save(references, response.products[0]) - elif response.response_type == dk.SearchResponseTypes.MANY: - # A search for "FOO" might return products "FOO" and "FOOZ" so we pick out the ones with the matching mpn - # This will often be more than one product, but digikey shows the same part in different packagings. - viable_products = [p for p in response.products if p.mpn == mpn] - - if len(viable_products) == 0: - logger.warning("BUG: Got multiple hits ({}) but didn't find anyone that matched the MPN. Strange!". - format(len(response.products))) - else: - if len(viable_products) == 1: - part = viable_products[0] - else: - # Pick the first one, should be as good as any - part = sorted(viable_products, key=lambda x: x.part_number)[0] - - logger.info("Got multiple hits ({})".format(len(viable_products))) - - save(references, part) - elif response.response_type == dk.SearchResponseTypes.TOO_MANY: - logger.warning("to many matches") - elif response.response_type == dk.SearchResponseTypes.NO_MATCHES: - logger.warning("no matches") - - -def task_digikey_resolve_schematic_components(): - out_data_set, in_data_sets = doit_config.data_sets_for(task_digikey_resolve_schematic_components) - - def action(): - in_ds = doit_config.dsm.load_data_sets(in_data_sets) - - with doit_config.dsm.create_rw(out_data_set, clean=False) as output: - resolve_schematic_components(output, in_ds) - - return dict( - file_dep=[doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - actions=[action], - targets=[doit_config.dsm.cookie_for_ds(out_data_set)], - ) - - -doit_config.set_data_sets_for(task_digikey_resolve_schematic_components, - "digikey-resolved-parts", "components") - - -def download_part_facts(output: DataSet, in_ds: DataSet): - digikey = dk.Digikey() - client = dk.DigikeyClient(digikey, on_download=logger.debug) - - parts = [o for o in in_ds.items() if - o.object_type.name == "component-to-part-mapping" and - o.get("seller") == "digikey"] - - for pn in sorted({part.get("part-number") for part in parts}): - logger.info("Downloading facts for {}".format(pn)) - - response = client.search(pn) - - if response.response_type == dk.SearchResponseTypes.SINGLE: - product = response.products[0] - - o = output.create_object("digikey-part", pn, replace=True). \ - set("part-number", product.part_number). \ - set("url", product.url). \ - set("mpn", product.mpn) - - for a in product.attributes: - key = "{}/{}".format(a.attribute_type.id, a.attribute_type.label) - o.set(key, a.value) - - -def task_digikey_fetch_full_part_facts(): - out_data_set, in_data_sets = doit_config.data_sets_for(task_digikey_fetch_full_part_facts) - - def action(): - in_ds = doit_config.dsm.load_data_sets(in_data_sets) - - with doit_config.dsm.create_rw(out_data_set, clean=False) as output: - download_part_facts(output, in_ds) - - return dict( - file_dep=[doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - actions=[action], - targets=[doit_config.dsm.cookie_for_ds(out_data_set)], - ) - - -doit_config.set_data_sets_for(task_digikey_fetch_full_part_facts, - "digikey-parts", "digikey-resolved-parts") diff --git a/src/ee/doit.py b/src/ee/doit.py deleted file mode 100644 index 665f039..0000000 --- a/src/ee/doit.py +++ /dev/null @@ -1,94 +0,0 @@ -import logging -from typing import Tuple, List, Mapping, Any - -from doit import get_var - -from ee.ds import DataSetManager - -logger = logging.getLogger(__name__) - - -def configure_logging(): - log_level = get_var("log-level", None) - - if log_level: - ee_logger = logging.getLogger("ee") - formatter = logging.Formatter("%(levelname)s: %(message)s") - ch = logging.StreamHandler() - ch.setFormatter(formatter) - ee_logger.addHandler(ch) - - ee_logger.setLevel(log_level) - - -class Report(object): - def __init__(self, task): - self.task = task - - -class ReportCollection(object): - def __init__(self): - self._reports = [] # type: List[Report] - - def add_report(self, report: Report): - self._reports.append(report) - - @property - def reports(self) -> Tuple[Report]: - return tuple(self._reports) - - -# This should probably be called "DoItModuleConfig" since it is used once per module. The module is responsible for -# instantiating it. -class DoItConfig(object): - def __init__(self): - self._dsm = None # type: DataSetManager - self._report_collection = None # type: ReportCollection - self._extra_config = None # type: Mapping[str, Any] - self._data_sets = {} - self._reports = [] - - def configure(self, *, data_set_manager: DataSetManager, report_collection: ReportCollection = None, - extra_config: Mapping[str, Any] = None): - self._dsm = data_set_manager - self._report_collection = report_collection if report_collection is not None else {} - self._extra_config = extra_config - - @property - def dsm(self) -> DataSetManager: - if self._dsm is None: - raise Exception("The data set manager has not been set") - return self._dsm - - @property - def report_collection(self): - if self._report_collection is None: - raise Exception("The report collection has not been set") - return self._report_collection - - @property - def extra_config(self): - return self._extra_config - - def data_sets_for(self, task): - try: - return self._data_sets[task] - except KeyError: - raise KeyError("No such task registered in this module: {}".format(task)) - - def out_data_set_for(self, task): - return self.data_sets_for(task)[0] - - def input_data_sets_for(self, task): - return self.data_sets_for(task)[1] - - def set_data_sets_for(self, task, out_dataset: str, *in_datasets: str): - self._data_sets[task] = [out_dataset, list(in_datasets)] - - def change_data_sets_for_task(self, task, _callable): - ds = self._data_sets[task] - ds[1] = _callable(ds[1]) - - def append_in_data_set_for_task(self, task, *data_sets: str): - ds = self._data_sets[task] - ds[1] = ds[1] + list(data_sets) diff --git a/src/ee/ds/__init__.py b/src/ee/ds/__init__.py deleted file mode 100644 index 915dd6f..0000000 --- a/src/ee/ds/__init__.py +++ /dev/null @@ -1,491 +0,0 @@ -import configparser -import csv -import logging -import os -import shutil -from functools import total_ordering -from pathlib import Path -from typing import MutableMapping, Optional, List, Tuple, Union, Iterator, Iterable - -logger = logging.getLogger(__name__) - - -@total_ordering -class ObjectType(object): - def __init__(self, name: str): - self._name = name - self._fields = [] # type: List[str] - - def __eq__(self, o) -> bool: - other = o # type: ObjectType - return isinstance(o, ObjectType) and self._name == other._name - - def __lt__(self, o: object) -> bool: - if not isinstance(o, ObjectType): - return True - - other = o # type: ObjectType - return self._name < other._name - - def __hash__(self) -> int: - return self._name.__hash__() - - @property - def name(self): - return self._name - - @property - def fields(self): - return self._fields - - def index_of(self, field: str, create: bool = False) -> Optional[int]: - try: - return self._fields.index(field) - except ValueError: - if not create: - return None - - self._fields.append(field) - return len(self._fields) - 1 - - def has(self, *keys: str): - return all([key in self._fields for key in keys]) - - -class Object(object): - class ValueList(list): - """An auto-expanding version of list.""" - - def __setitem__(self, index, value): - if index >= len(self): - self.extend([None] * (index + 1 - len(self))) - list.__setitem__(self, index, value) - - def __getitem__(self, index): - if index >= len(self): - self.extend([None] * (index + 1 - len(self))) - return list.__getitem__(self, index) - - def __init__(self, ds: "DataSet", ot: ObjectType, key: str): - self._ds = ds - self._ot = ot - self._key = key - self._data = Object.ValueList() - - @property - def object_type(self): - return self._ot - - @property - def key(self): - return self._key - - def set(self, key: str, value: str) -> "Object": - if self._ds._frozen: - raise Exception("This data set is frozen") - idx = self._ot.index_of(key, create=True) - self._data[idx] = value - - return self - - def _set_from_object(self, other: "Object"): - for k in other._ot.fields: - self.set(k, other.get(k)) - - def has_values(self, *keys: str) -> bool: - return all([len(value) > 0 for value in [self.get(key) for key in keys] if value is not None]) - - def values(self, *keys: str, strip: bool = False, required: bool = True) -> List[Optional[str]]: - """Looks up all values for all keys. - - If required=True, strip is also set to True - - - If strip is True, all values are stripped with str.strip(). None values are preserved. - - If required=True, all values has to have a len() > 0. If any fails the requirement, a list with only None values - is returned. - """ - - values = [] - - strip = True if required else strip - - for key in keys: - v = self.get(key) - - if strip: - v = v.strip() if v else v - - if required: - if v is None or len(v) == 0: - return [None] * len(keys) - - values.append(v) - - return values - - def get(self, key: str) -> Optional[str]: - idx = self._ot.index_of(key) - return self._data[idx] if idx is not None else None - - def get_req(self, key: str) -> str: - idx = self._ot.index_of(key) - if idx is not None and idx < len(self._data): - return self._data[idx] - else: - raise Exception("No such field: {}".format(key)) - - def get_all(self, *keys: str) -> Optional[List[str]]: - values = [] - for key in keys: - idx = self._ot.index_of(key) - if not idx or idx >= len(self._data): - return None - values.append(self._data[idx]) - return values - - -class DataSet(object): - def __init__(self): - self._object_types = {} # type: MutableMapping[str, ObjectType] - self._objects_by_type = {} # type: MutableMapping[ObjectType, MutableMapping[str, Object]] - self._frozen = False - - def __len__(self): - return sum((len(objects) for objects in self._objects_by_type.values())) - - def freeze(self): - self._frozen = True - - def _assert_not_frozen(self): - if self._frozen: - raise Exception("This data set is frozen") - - def _check_object_type(self, object_type: str, create: bool) -> \ - Optional[Tuple[ObjectType, MutableMapping[str, Object]]]: - try: - ot = self._object_types[object_type] - objects = self._objects_by_type[ot] - return ot, objects, - except KeyError: - if not create: - return None - - self._assert_not_frozen() - - ot = ObjectType(object_type) - self._object_types[object_type] = ot - self._objects_by_type[ot] = objects = {} - return ot, objects, - - def _check_object(self, object_type: str, key: str, create: bool) -> Optional[Object]: - t = self._check_object_type(object_type, create) - - if not t: - return None - - ot, objects = t - try: - return objects[key] - except KeyError: - self._assert_not_frozen() - - if not create: - raise Exception("No such object: {}:{}".format(object_type, key)) - - o = Object(self, ot, key) - objects[key] = o - return o - - def get_object_type(self, object_type: str) -> ObjectType: - t = self._check_object_type(object_type, False) - - if not t: - raise Exception("No such object type: {}".format(object_type)) - - ot, objects = t - return ot - - def get_object(self, object_type: str, key: str) -> Object: - o = self._check_object(object_type, key, False) - - if not o: - raise Exception("No such object: {}:{}".format(object_type, key)) - - return o - - def has_object(self, object_type: str, key: str) -> bool: - t = self._check_object_type(object_type, False) - - if t: - ot, objects = t - return key in objects - - return False - - def get_or_create_object(self, object_type: str, key: str) -> Object: - return self._check_object(object_type, key, True) - - def create_object(self, object_type: str, key: str, replace=False) -> Object: - self._assert_not_frozen() - - if self.has_object(object_type, key): - if not replace: - raise Exception("Object already exist: {}:{}".format(object_type, key)) - - ot, objects = self._check_object_type(object_type, False) - del self._objects_by_type[ot][key] - - return self._check_object(object_type, key, True) - - def items(self) -> Iterator[Object]: - for objects in self._objects_by_type.values(): - for o in objects.values(): - yield o - - def merge(self, other: "DataSet") -> "DataSet": - ds = DataSet() - for objects in self._objects_by_type.values(): - for o in objects.values(): - ds.create_object(o.object_type.name, o.key)._set_from_object(o) - - for objects in other._objects_by_type.values(): - for o in objects.values(): - ds.get_or_create_object(o.object_type.name, o.key)._set_from_object(o) - - return ds - - def import_object(self, other: Object) -> Object: - o = self._check_object(other.object_type.name, other.key, create=True) - - for k in other.object_type.fields: - o.set(k, other.get(k)) - - return o - - -class DataSetManager(object): - def __init__(self, basedir: Union[Path, str]): - self._basedir = Path(basedir) - self._csv = {} # type: MutableMapping[str, Tuple[str, Path]] - - @property - def all_data_sets(self): - datasets = [ds.name for ds in self._basedir.iterdir() if (ds / "data-set.ini").is_file()] - return list(self._csv.keys()) + datasets - - def cookie_for_ds(self, ds_name) -> Path: - try: - return self._csv[ds_name][1] - except KeyError: - return self._basedir / ds_name / "data-set.ini" - - def create_rw(self, name, clean: bool) -> "LazyRwDataSet": - return LazyRwDataSet(self, name, clean) - - def load_data_sets(self, inputs: List[str], freeze: bool = True) -> DataSet: - ds = DataSet() - for name in inputs: - ds = ds.merge(self.load(name, freeze=True)) - - if freeze: - ds.freeze() - - return ds - - def register_ds(self, ds_type: str, name: str, object_type: str, path: str = None): - if ds_type == "csv": - if name in self._csv: - raise Exception("Data source already exists: {}".format(name)) - - self._csv[name] = object_type, Path(path), - else: - raise Exception("Unknown data source type: {}".format(ds_type)) - - def ds_type(self, name: str): - return "csv" if name in self._csv else "ini-dir" - - def load(self, path, freeze=False) -> DataSet: - try: - object_type, path = self._csv[path] - - if not freeze: - raise Exception("CSV data sources must be frozen") - - return DataSetManager._load_csv(object_type, path, freeze) - except KeyError: - return self._load_ini_dir(path, freeze) - - @staticmethod - def _load_csv(object_type: str, path: Path, freeze: bool) -> DataSet: - # logger.debug("Loading CSV file {}".format(path)) - ds = DataSet() - - with open(str(path), newline='') as f: - r = csv.reader(f) - - header = next(r, None) - for row in r: - if len(row) == 0: - continue - - key = row[0] - - o = ds.create_object(object_type, key) - for idx, value in zip(range(0, min(len(row), len(header))), row): - o.set(header[idx], value) - - if freeze: - ds.freeze() - - # logger.debug("Loaded {} objects".format(len(ds))) - return ds - - def _load_ini_dir(self, _path: str, freeze: bool) -> DataSet: - ds_dir = Path(_path) if Path(_path).is_absolute() else self._basedir / _path - ds_dir = ds_dir if ds_dir.is_dir() else ds_dir.parent - - # logger.debug("Loading DS from '{}'".format(ds_dir)) - - self._load_ini(ds_dir / "data-set.ini") - - ds = DataSet() - count = 0 - for ot_path in ds_dir.glob("*"): - if not ot_path.is_dir(): - continue - - ot = ot_path.name - # logger.debug(" Loading type '{}'".format(ot)) - for o_path in ot_path.glob("*.ini"): - count += 1 - - key = o_path.name[:-4] - # logger.debug(" Loading key '{}'".format(key)) - ini = self._load_ini(o_path) - o = ds.create_object(ot, key) - for k, v in ini.items("values"): - o.set(k, v) - - if freeze: - ds.freeze() - - # logger.debug("Loaded {} items".format(count)) - return ds - - def store(self, ds: DataSet, ds_name: str): - ds_dir = self._basedir / ds_name - items = list(ds.items()) - # logger.info("Storing DS '{}' with {} objects to {}".format(ds_name, len(items), ds_dir)) - - os.makedirs(ds_dir, exist_ok=True) - ini = self._blank_ini() - ini.add_section("data-set") - ini.set("data-set", "name", ds_name) - self._store_ini(ini, ds_dir / "data-set.ini") - - for o in items: - ot = o.object_type - key = o.key - - ot_dir = ds_dir / ot.name - os.makedirs(ot_dir, exist_ok=True) - ini = self._blank_ini() - ini.add_section("meta") - ini.set("meta", "type", ot.name) - - ini.add_section("values") - for k in ot.fields: - v = o.get(k) - if v: - ini.set("values", k, str(v)) - self._store_ini(ini, ot_dir / "{}.ini".format(key)) - - # noinspection PyMethodMayBeStatic - def store_csv(self, path: Union[str, Path], ds: DataSet, object_type: str, - order_by: Union[str, Iterable[str]] = None, fields: List[str] = None, - include_extra_fields: bool = True): - items = [o for o in ds.items() if o.object_type.name == object_type] - - if order_by: - if isinstance(order_by, str): - items = sorted(items, key=lambda o: o.get_req(order_by)) - elif isinstance(order_by, Iterable): - items = sorted(items, key=lambda o: [o.get_req(ob) for ob in order_by]) - else: - raise Exception("Unsupported order_by") - - with open(path, "w") as f: - w = csv.writer(f, lineterminator=os.linesep) - - if len(items): - - if fields is not None: - header = list(fields) - - if include_extra_fields: - header.append(set(ds.get_object_type(object_type).fields) - set(header)) - else: - header = ds.get_object_type(object_type).fields - w.writerow(header) - - for o in items: - row = [o.get(k) for k in header] - w.writerow(row) - - @staticmethod - def _blank_ini(): - parser = configparser.ConfigParser(interpolation=None) - parser.optionxform = str - return parser - - def _load_ini(self, path: Path): - ini = self._blank_ini() - if len(ini.read(str(path))) != 1: - raise IOError("Could not load ini file: {}".format(path)) - return ini - - @staticmethod - def _store_ini(ini, path): - with open(path, "w") as f: - ini.write(f) - - def remove(self, name: str): - try: - object_type, path = self._csv[name] - os.remove(str(path)) - except KeyError: - shutil.rmtree(self._basedir / name) - - -class LazyRwDataSet(object): - def __init__(self, dsm: DataSetManager, name, clean): - self._dsm = dsm - self._name = name - self._clean = clean - - def __enter__(self) -> DataSet: - cookie = self._dsm.cookie_for_ds(self._name) - - if cookie.exists(): - if self._clean: - self._dsm.remove(self._name) - ds = DataSet() - else: - ds = self._dsm.load(self._name) - else: - ds = DataSet() - - self._ds = ds - return ds - - def __exit__(self, *args): - self._dsm.store(self._ds, self._name) - return False - - -def create_message(data_set: DataSet, message: str, level: str): - return data_set.create_object("message", "message-{}".format(str(abs(hash(message))))). \ - set("message", message). \ - set("level", level) diff --git a/src/ee/kicad/doit.py b/src/ee/kicad/doit.py deleted file mode 100644 index c881c70..0000000 --- a/src/ee/kicad/doit.py +++ /dev/null @@ -1,224 +0,0 @@ -import logging -import os.path -from pathlib import Path -from typing import Mapping - -from configclass import Config - -import ee.kicad -import ee.kicad.pcb -from ee.doit import DoItConfig - -logger = logging.getLogger(__name__) - -_config_template = Config({ - "sch": None, - "kicad_pcb": None, - "gerber_dir": None, - "gerber_zip": None, -}) - -doit_config = DoItConfig() - -_config = None # type: Mapping[str, str] - - -def init(**kwargs): - global _config - _config = _config_template.make(kwargs) - - -def task_kicad_gerber(): - kicad_pcb = _config["kicad_pcb"] - gerber_dir = _config["gerber_dir"] - gerber_zip = _config["gerber_zip"] - - gerber_zip = gerber_zip or "{}.zip".format(gerber_dir) - - # logger.info("gerber_zip={}".format(gerber_zip)) - - eg = next((p for p in (os.path.join(p, "export_gerber.py") for p in ee.kicad.__path__) if os.path.isfile(p)), None) - if not eg: - raise Exception("Could not find export_gerber.py") - - # TODO: replace with python - mkdir = "mkdir -p {}".format(gerber_dir) - export_gerber = " ".join([ - eg, - "--pcb", kicad_pcb, - "--output-directory", gerber_dir, - "--protel-extensions", - ]) - - def make_zip(): - import zipfile - from pathlib import Path - with zipfile.ZipFile(gerber_zip, "w") as z: - for p in Path(gerber_dir).iterdir(): - if not p.is_file(): - continue - z.write(p, arcname=p.relative_to(gerber_dir)) - - return { - "targets": [gerber_zip], - "actions": [mkdir, export_gerber, make_zip], - "file_dep": [kicad_pcb], - } - - -def task_kicad_sch_to_data_set(): - out_data_set, in_data_sets = doit_config.data_sets_for(task_kicad_sch_to_data_set) - - sch = _config["sch"] - - def action(): - from ee.kicad.model import ComponentField - - with doit_config.dsm.create_rw(out_data_set, clean=True) as ds: - schematics = ee.kicad.read_schematics(sch) - for c in [c for c in schematics.components]: - o = ds.create_object("kicad-schematic-component", c.timestamp) - o.set("ref", c.ref) - o.set("ref-type", c.ref_type) - if c.has_ref_num: - o.set("ref-num", str(c.ref_num)) - o.set("value", c.value) - if c.footprint: - o.set("footprint", c.footprint) - - for f in c.fields: - if f.value and f.name not in ComponentField.names: - o.set("field-{}".format(f.name), str(f.value)) - - return { - "file_dep": [Path(sch)] + [doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - "actions": [action], - "targets": [doit_config.dsm.cookie_for_ds(out_data_set)], - } - - -doit_config.set_data_sets_for(task_kicad_sch_to_data_set, "kicad-sch") - - -def task_kicad_pcb_to_data_set(): - kicad_pcb = _config["kicad_pcb"] - - out_data_set, in_data_sets = doit_config.data_sets_for(task_kicad_pcb_to_data_set) - - def action(): - from ee.kicad.pcb import KicadPcb, Module - - logger.debug("Parsing PCB {}".format(kicad_pcb)) - - with doit_config.dsm.create_rw(out_data_set, clean=True) as ds: - # [ds.delete(o) for o in ds.items(object_type="kicad-pcb-component")] - - pcb = ee.kicad.pcb.parse(kicad_pcb) # type: KicadPcb - for _m in pcb.modules: - m = _m # type: Module - - o = ds.create_object("kicad-pcb-component", m.tstamp) - - ref_text = next((t for t in m.fp_texts if t.kind == "reference"), None) - o.set("ref", ref_text.value) - - x, y, rot = m.at - o.set("placement-x", x) - o.set("placement-y", y) - o.set("placement-rotation", rot) - o.set("layer", m.layer) - - return { - "file_dep": [Path(kicad_pcb)] + [doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - "actions": [action], - "targets": [doit_config.dsm.cookie_for_ds(out_data_set)], - } - - -doit_config.set_data_sets_for(task_kicad_pcb_to_data_set, "kicad-pcb") - - -def task_kicad_create_component_data_set(): - out_data_set, in_data_sets = doit_config.data_sets_for(task_kicad_create_component_data_set) - - def action(): - in_ds = doit_config.dsm.load_data_sets(in_data_sets) - - # for o in in_ds.items(): - # logger.info("item: {}/{}".format(o.object_type.name, o.key)) - - def map_footprint(footprint): - for o in in_ds.items(): - if not o.object_type.name == "kicad-footprint-mapping": - continue - - common = o.get("common") - if common: - return common - - return footprint - - with doit_config.dsm.create_rw(out_data_set, clean=True) as output: - kicad_sch = [o for o in in_ds.items() if o.object_type.name == "kicad-schematic-component"] - - logger.info("processing {} kicad-sch".format(len(kicad_sch))) - - ignored_ref_types = {"#PWR", "#FLG"} - - for sch in kicad_sch: - ref = sch.get("ref") - ref_num = sch.get("ref-num") - if not ref or not ref_num: - logger.debug("Missing ref or ref-num") - continue - - ref_type = sch.get("ref-type") - if not ref_type: - logger.debug("Missing ref-type") - continue - - if ref_type in ignored_ref_types: - continue - - c = output.create_object("component", ref) - c.set("ref", ref) - c.set("ref-num", ref_num) - c.set("ref-type", ref_type) - - fp = sch.get("footprint") - if fp: - fp = map_footprint(fp) - c.set("footprint", fp) - - c.set("mpn", sch.get("field-mpn")) - c.set("distributor", sch.get("field-distributor")) - - def pcb_match(o): - return o.object_type.name == "kicad-pcb-component" and \ - o.get("ref") == ref - - pcb = [o for o in in_ds.items() if pcb_match(o)] - - if not pcb: - logger.info("Could not find PCB component for {}".format(ref)) - - # TODO: check that the SCH and PCB footprint are the same - # c.set("footprint", pcb.) - - return { - "file_dep": [doit_config.dsm.cookie_for_ds(ds) for ds in in_data_sets], - "actions": [action], - "targets": [doit_config.dsm.cookie_for_ds(out_data_set)], - } - - -doit_config.set_data_sets_for(task_kicad_create_component_data_set, "components", "kicad-sch", "kicad-pcb") - -__all__ = [ - init.__name__, - - task_kicad_create_component_data_set.__name__, - task_kicad_gerber.__name__, - task_kicad_pcb_to_data_set.__name__, - task_kicad_sch_to_data_set.__name__, -] diff --git a/src/ee/report/__init__.py b/src/ee/report/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/src/ee/report/__init__.py +++ /dev/null diff --git a/src/ee/report/doit.py b/src/ee/report/doit.py deleted file mode 100644 index 5d28ed4..0000000 --- a/src/ee/report/doit.py +++ /dev/null @@ -1,61 +0,0 @@ -import logging -from pathlib import Path - -from jinja2 import Environment, PackageLoader, select_autoescape - -from ee.doit import DoItConfig, Report - -logger = logging.getLogger(__name__) - -doit_config = DoItConfig() - - -def _create_env(): - return Environment( - loader=PackageLoader("ee.report.doit", "templates"), - autoescape=select_autoescape(["html", "xml"]) - ) - - -def task_report_messages(): - doit_config.report_collection.add_report(Report(task_report_messages)) - - def action(): - logger.debug("Generating messages report") - - data_sets = doit_config.dsm.all_data_sets - - logger.debug("Loading {} data sets".format(len(data_sets))) - - ds = doit_config.dsm.load_data_sets(data_sets) - - messages = [o for o in ds.items() if o.object_type.name == "message"] - logger.debug("Found {} messages".format(len(messages))) - - report_dir = Path(doit_config.extra_config["report_dir"]) - report_dir.mkdir(exist_ok=True) - - with open(report_dir / "messages.rst", "w") as f: - env = _create_env() - template = env.get_template("messages.rst.j2") - f.write(template.render(messages=messages)) - - return { - "actions": [action] - } - - -def task_make_reports(): - def action(): - report_dir = Path(doit_config.extra_config["report_dir"]) - report_dir.mkdir(exist_ok=True) - - with open(report_dir / "index.rst", "w") as f: - env = _create_env() - template = env.get_template("index.rst.j2") - f.write(template.render()) - - return { - "actions": [action], - "task_dep": [r.task.__name__[5:] for r in doit_config.report_collection.reports] - } diff --git a/src/ee/report/templates/index.rst.j2 b/src/ee/report/templates/index.rst.j2 deleted file mode 100644 index 5eaf939..0000000 --- a/src/ee/report/templates/index.rst.j2 +++ /dev/null @@ -1,4 +0,0 @@ -Reports -======= - -* :doc:`messages` diff --git a/src/ee/report/templates/messages.rst.j2 b/src/ee/report/templates/messages.rst.j2 deleted file mode 100644 index ca08c04..0000000 --- a/src/ee/report/templates/messages.rst.j2 +++ /dev/null @@ -1,8 +0,0 @@ -Messages -======== - -There are {{ messages|count }} messages. - -{% for m in messages %} - Message: {{ m.level }} -{% endfor %} diff --git a/test/doit/schematics/ee/kicad-footprint.csv b/test/doit/schematics/ee/kicad-footprint.csv deleted file mode 100644 index fa5cd5f..0000000 --- a/test/doit/schematics/ee/kicad-footprint.csv +++ /dev/null @@ -1,45 +0,0 @@ -kicad,common -Capacitors_SMD:C_0402,0402 -Capacitors_SMD:C_0402_NoSilk,0402 -Capacitors_SMD:C_0603,0603 -Capacitors_SMD:C_0603_NoSilk,0603 -Capacitors_SMD:C_0805,0805 -Capacitors_SMD:C_0805_NoSilk,0805 -Diodes_SMD:D_SMA_Handsoldering,SMA -Diodes_SMD:D_SMA,SMA -Resistors_SMD:R_0402,0402 -Resistors_SMD:R_0402_NoSilk,0402 -Resistors_SMD:R_0805,0805 -TO_SOT_Packages_SMD:SOT-223,TO-261-4 -TO_SOT_Packages_SMD:SOT-23-6_Handsoldering,SOT-23-6 -TO_SOT_Packages_SMD:SOT-23,SOT-23 -Package_TO_SOT_SMD:SOT-23,SOT-23 -Bitraf:SOT-563,SOT-563 - -Diode_SMD:D_SOD-323,SOD-323 - -IPC7351-Nominal:CAPC1005X55,0402 -IPC7351-Nominal:CAPC1608X55,0603 -IPC7351-Nominal:CAPC2012X70,0805 -IPC7351-Nominal:CAPC3216X70,1206 -IPC7351-Nominal:CAPC3225X88,1210 -IPC7351-Nominal:CAPC4532X102,1812 -IPC7351-Nominal:CAPC4564X203,1825 - -IPC7351-Nominal:LEDC1005X110,0402 -IPC7351-Nominal:LEDC1310X110,0504 -IPC7351-Nominal:LEDC1608X110,0603 -IPC7351-Nominal:LEDC2012X110,0805 -IPC7351-Nominal:LEDC3216X110,1206 -IPC7351-Nominal:LEDC3225X110,1210 -IPC7351-Nominal:LEDC4532X110,1812 -IPC7351-Nominal:LEDC4564X110,1825 - -IPC7351-Nominal:RESC1005X38,0402 -IPC7351-Nominal:RESC1310X51,0504 -IPC7351-Nominal:RESC1608X63,0603 -IPC7351-Nominal:RESC2012X50,0805 -IPC7351-Nominal:RESC3216X60,1206 -IPC7351-Nominal:RESC3225X60,1210 -IPC7351-Nominal:RESC4532X70,1812 -IPC7351-Nominal:RESC4564X110,1825 diff --git a/test/doit/schematics/schematic-1.kicad_pcb b/test/doit/schematics/schematic-1.kicad_pcb deleted file mode 100644 index fcb69aa..0000000 --- a/test/doit/schematics/schematic-1.kicad_pcb +++ /dev/null @@ -1,298 +0,0 @@ -(kicad_pcb (version 20171130) (host pcbnew 5.0.0-rc3+dfsg1-2) - - (general - (thickness 1.6) - (drawings 0) - (tracks 10) - (zones 0) - (modules 4) - (nets 5) - ) - - (page A4) - (layers - (0 F.Cu signal) - (31 B.Cu signal) - (32 B.Adhes user) - (33 F.Adhes user) - (34 B.Paste user) - (35 F.Paste user) - (36 B.SilkS user) - (37 F.SilkS user) - (38 B.Mask user) - (39 F.Mask user) - (40 Dwgs.User user) - (41 Cmts.User user) - (42 Eco1.User user) - (43 Eco2.User user) - (44 Edge.Cuts user) - (45 Margin user) - (46 B.CrtYd user) - (47 F.CrtYd user) - (48 B.Fab user) - (49 F.Fab user) - ) - - (setup - (last_trace_width 0.25) - (trace_clearance 0.2) - (zone_clearance 0.508) - (zone_45_only no) - (trace_min 0.2) - (segment_width 0.2) - (edge_width 0.15) - (via_size 0.8) - (via_drill 0.4) - (via_min_size 0.4) - (via_min_drill 0.3) - (uvia_size 0.3) - (uvia_drill 0.1) - (uvias_allowed no) - (uvia_min_size 0.2) - (uvia_min_drill 0.1) - (pcb_text_width 0.3) - (pcb_text_size 1.5 1.5) - (mod_edge_width 0.15) - (mod_text_size 1 1) - (mod_text_width 0.15) - (pad_size 1.524 1.524) - (pad_drill 0.762) - (pad_to_mask_clearance 0.2) - (aux_axis_origin 0 0) - (visible_elements FFFFFF7F) - (pcbplotparams - (layerselection 0x010fc_ffffffff) - (usegerberextensions false) - (usegerberattributes false) - (usegerberadvancedattributes false) - (creategerberjobfile false) - (excludeedgelayer true) - (linewidth 0.100000) - (plotframeref false) - (viasonmask false) - (mode 1) - (useauxorigin false) - (hpglpennumber 1) - (hpglpenspeed 20) - (hpglpendiameter 15.000000) - (psnegative false) - (psa4output false) - (plotreference true) - (plotvalue true) - (plotinvisibletext false) - (padsonsilk false) - (subtractmaskfromsilk false) - (outputformat 1) - (mirror false) - (drillshape 1) - (scaleselection 1) - (outputdirectory "")) - ) - - (net 0 "") - (net 1 "Net-(BT1-Pad1)") - (net 2 GND) - (net 3 "Net-(C1-Pad1)") - (net 4 "Net-(R1-Pad1)") - - (net_class Default "This is the default net class." - (clearance 0.2) - (trace_width 0.25) - (via_dia 0.8) - (via_drill 0.4) - (uvia_dia 0.3) - (uvia_drill 0.1) - (add_net GND) - (add_net "Net-(BT1-Pad1)") - (add_net "Net-(C1-Pad1)") - (add_net "Net-(R1-Pad1)") - ) - - (module Battery:BatteryHolder_MPD_BC2AAPC_2xAA (layer F.Cu) (tedit 5AC8F8F7) (tstamp 5B5BC36D) - (at 71.75 60.5) - (descr "2xAA cell battery holder, Memory Protection Devices P/N BC2AAPC, http://www.memoryprotectiondevices.com/datasheets/BC2AAPC-datasheet.pdf") - (tags "AA battery cell holder") - (path /5B431438) - (fp_text reference BT1 (at 26.16 -10.11) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 9V (at 26.16 23.39) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -2.84 -8.61) (end -2.84 21.89) (layer F.Fab) (width 0.1)) - (fp_line (start -2.84 21.89) (end 55.16 21.89) (layer F.Fab) (width 0.1)) - (fp_line (start 55.16 21.89) (end 55.16 -8.61) (layer F.Fab) (width 0.1)) - (fp_line (start 55.16 -8.61) (end -2.84 -8.61) (layer F.Fab) (width 0.1)) - (fp_line (start -2.94 -8.71) (end -2.94 21.99) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.94 21.99) (end 55.26 21.99) (layer F.SilkS) (width 0.12)) - (fp_line (start 55.26 21.99) (end 55.26 -8.71) (layer F.SilkS) (width 0.12)) - (fp_line (start 55.26 -8.71) (end -2.94 -8.71) (layer F.SilkS) (width 0.12)) - (fp_line (start -3.34 -9.11) (end -3.34 22.39) (layer F.CrtYd) (width 0.05)) - (fp_line (start -3.34 22.39) (end 55.66 22.39) (layer F.CrtYd) (width 0.05)) - (fp_line (start 55.66 22.39) (end 55.66 -9.11) (layer F.CrtYd) (width 0.05)) - (fp_line (start 55.66 -9.11) (end -3.34 -9.11) (layer F.CrtYd) (width 0.05)) - (fp_line (start 35.685 2.54) (end 17.905 2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 2.54) (end 17.905 1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 1.27) (end 16.635 1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 1.27) (end 16.635 -1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 -1.27) (end 17.905 -1.27) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 -1.27) (end 17.905 -2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 17.905 -2.54) (end 35.685 -2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 -2.54) (end 35.685 2.54) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 16.13) (end 34.415 16.13) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 16.13) (end 34.415 14.86) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 14.86) (end 35.685 14.86) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 14.86) (end 35.685 12.32) (layer F.SilkS) (width 0.12)) - (fp_line (start 35.685 12.32) (end 34.415 12.32) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 12.32) (end 34.415 11.05) (layer F.SilkS) (width 0.12)) - (fp_line (start 34.415 11.05) (end 16.635 11.05) (layer F.SilkS) (width 0.12)) - (fp_line (start 16.635 11.05) (end 16.635 16.13) (layer F.SilkS) (width 0.12)) - (fp_text user %R (at 26.16 6.63) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user - (at 36.955 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at 15.365 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user - (at 15.365 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at 36.955 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user + (at -4.34 0) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (fp_text user - (at -4.34 13.59) (layer F.SilkS) - (effects (font (size 1.5 1.5) (thickness 0.15))) - ) - (pad 1 thru_hole rect (at 0 0) (size 2.17 2.17) (drill 1.17) (layers *.Cu *.Mask) - (net 1 "Net-(BT1-Pad1)")) - (pad 2 thru_hole circle (at 0 13.59) (size 2.17 2.17) (drill 1.17) (layers *.Cu *.Mask) - (net 2 GND)) - (pad "" np_thru_hole circle (at 26.16 6.63) (size 3.65 3.65) (drill 3.65) (layers *.Cu *.Mask)) - (model ${KISYS3DMOD}/Battery.3dshapes/BatteryHolder_MPD_BC2AAPC_2xAA.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Resistor_SMD:R_1206_3216Metric (layer F.Cu) (tedit 5B20DC38) (tstamp 5B5BC1DF) - (at 60 61.4 90) - (descr "Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf), generated with kicad-footprint-generator") - (tags resistor) - (path /5B431328) - (attr smd) - (fp_text reference R1 (at 0 -1.82 90) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 10k (at 0 1.82 90) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -1.6 0.8) (end -1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -1.6 -0.8) (end 1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 -0.8) (end 1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 0.8) (end -1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -0.602064 -0.91) (end 0.602064 -0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.602064 0.91) (end 0.602064 0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.28 1.12) (end -2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.28 -1.12) (end 2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 -1.12) (end 2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 1.12) (end -2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_text user %R (at 0 0 90) (layer F.Fab) - (effects (font (size 0.8 0.8) (thickness 0.12))) - ) - (pad 1 smd roundrect (at -1.4 0 90) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 4 "Net-(R1-Pad1)")) - (pad 2 smd roundrect (at 1.4 0 90) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 1 "Net-(BT1-Pad1)")) - (model ${KISYS3DMOD}/Resistor_SMD.3dshapes/R_1206_3216Metric.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Capacitor_THT:CP_Radial_Tantal_D10.5mm_P5.00mm (layer F.Cu) (tedit 5AE50EF0) (tstamp 5B5D0FE8) - (at 51.25 76) - (descr "CP, Radial_Tantal series, Radial, pin pitch=5.00mm, , diameter=10.5mm, Tantal Electrolytic Capacitor, http://cdn-reichelt.de/documents/datenblatt/B300/TANTAL-TB-Serie%23.pdf") - (tags "CP Radial_Tantal series Radial pin pitch 5.00mm diameter 10.5mm Tantal Electrolytic Capacitor") - (path /5B4314AB) - (fp_text reference C1 (at 2.5 -6.5) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 1u (at 2.5 6.5) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_circle (center 2.5 0) (end 7.75 0) (layer F.Fab) (width 0.1)) - (fp_circle (center 2.5 0) (end 7.87 0) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.5 0) (end 8 0) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.004387 -2.2975) (end -0.954387 -2.2975) (layer F.Fab) (width 0.1)) - (fp_line (start -1.479387 -2.8225) (end -1.479387 -1.7725) (layer F.Fab) (width 0.1)) - (fp_line (start -3.247133 -3.015) (end -2.197133 -3.015) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.722133 -3.54) (end -2.722133 -2.49) (layer F.SilkS) (width 0.12)) - (fp_text user %R (at 2.5 0) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (pad 1 thru_hole rect (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) - (net 3 "Net-(C1-Pad1)")) - (pad 2 thru_hole circle (at 5 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) - (net 2 GND)) - (model ${KISYS3DMOD}/Capacitor_THT.3dshapes/CP_Radial_Tantal_D10.5mm_P5.00mm.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (module Resistor_SMD:R_1206_3216Metric (layer F.Cu) (tedit 5B20DC38) (tstamp 5B5D10B5) - (at 58.75 66.5) - (descr "Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf), generated with kicad-footprint-generator") - (tags resistor) - (path /5B5CC4D4) - (attr smd) - (fp_text reference R2 (at 0 -1.82) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text value 10k (at 0 1.82) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_line (start -1.6 0.8) (end -1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -1.6 -0.8) (end 1.6 -0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 -0.8) (end 1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start 1.6 0.8) (end -1.6 0.8) (layer F.Fab) (width 0.1)) - (fp_line (start -0.602064 -0.91) (end 0.602064 -0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.602064 0.91) (end 0.602064 0.91) (layer F.SilkS) (width 0.12)) - (fp_line (start -2.28 1.12) (end -2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start -2.28 -1.12) (end 2.28 -1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 -1.12) (end 2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_line (start 2.28 1.12) (end -2.28 1.12) (layer F.CrtYd) (width 0.05)) - (fp_text user %R (at 0 0) (layer F.Fab) - (effects (font (size 0.8 0.8) (thickness 0.12))) - ) - (pad 1 smd roundrect (at -1.4 0) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 3 "Net-(C1-Pad1)")) - (pad 2 smd roundrect (at 1.4 0) (size 1.25 1.75) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.2) - (net 4 "Net-(R1-Pad1)")) - (model ${KISYS3DMOD}/Resistor_SMD.3dshapes/R_1206_3216Metric.wrl - (at (xyz 0 0 0)) - (scale (xyz 1 1 1)) - (rotate (xyz 0 0 0)) - ) - ) - - (segment (start 71.25 60) (end 71.75 60.5) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 60 60) (end 71.25 60) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 62.91 74.09) (end 61 76) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 71.75 74.09) (end 62.91 74.09) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 56.25 76) (end 61 76) (width 0.25) (layer B.Cu) (net 2)) - (segment (start 53.25 66.5) (end 51.25 68.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 57.35 66.5) (end 53.25 66.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 51.25 76) (end 51.25 68.5) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 60 66.35) (end 60.15 66.5) (width 0.25) (layer F.Cu) (net 4)) - (segment (start 60 62.8) (end 60 66.35) (width 0.25) (layer F.Cu) (net 4)) - -) diff --git a/test/doit/schematics/schematic-1.pro b/test/doit/schematics/schematic-1.pro deleted file mode 100644 index dd201c7..0000000 --- a/test/doit/schematics/schematic-1.pro +++ /dev/null @@ -1,7 +0,0 @@ -update=22/05/2015 07:44:53 -version=1 -last_client=kicad -[general] -version=1 -RootSch= -BoardNm= diff --git a/test/doit/schematics/schematic-1.sch b/test/doit/schematics/schematic-1.sch deleted file mode 100644 index a0175f3..0000000 --- a/test/doit/schematics/schematic-1.sch +++ /dev/null @@ -1,94 +0,0 @@ -EESchema Schematic File Version 4 -EELAYER 26 0 -EELAYER END -$Descr A4 11693 8268 -encoding utf-8 -Sheet 1 1 -Title "" -Date "" -Rev "" -Comp "" -Comment1 "" -Comment2 "" -Comment3 "" -Comment4 "" -$EndDescr -$Comp -L Device:R R1 -U 1 1 5B431328 -P 4150 2600 -F 0 "R1" V 3943 2600 50 0000 C CNN -F 1 "10k" V 4034 2600 50 0000 C CNN -F 2 "Resistor_SMD:R_1206_3216Metric" V 4080 2600 50 0001 C CNN -F 3 "~" H 4150 2600 50 0001 C CNN -F 4 "RMCF1206JT10K0" V 4150 2600 50 0001 C CNN "mpn" - 1 4150 2600 - 0 1 1 0 -$EndComp -$Comp -L Device:Battery_Cell BT1 -U 1 1 5B431438 -P 3700 2900 -F 0 "BT1" H 3818 2996 50 0000 L CNN -F 1 "9V" H 3818 2905 50 0000 L CNN -F 2 "Battery:BatteryHolder_MPD_BC2AAPC_2xAA" V 3700 2960 50 0001 C CNN -F 3 "~" V 3700 2960 50 0001 C CNN -F 4 "BC2AAPC" H 3700 2900 50 0001 C CNN "mpn" - 1 3700 2900 - 1 0 0 -1 -$EndComp -$Comp -L Device:C C1 -U 1 1 5B4314AB -P 5100 2850 -F 0 "C1" H 5215 2896 50 0000 L CNN -F 1 "1u" H 5215 2805 50 0000 L CNN -F 2 "Capacitor_THT:CP_Radial_Tantal_D10.5mm_P5.00mm" H 5138 2700 50 0001 C CNN -F 3 "~" H 5100 2850 50 0001 C CNN -F 4 "UCA2G100MPD1TD" H 5100 2850 50 0001 C CNN "mpn" - 1 5100 2850 - 1 0 0 -1 -$EndComp -Wire Wire Line - 3700 3000 3700 3100 -Wire Wire Line - 5100 3100 5100 3000 -$Comp -L power:GND #PWR0101 -U 1 1 5B4315FE -P 3700 3200 -F 0 "#PWR0101" H 3700 2950 50 0001 C CNN -F 1 "GND" H 3705 3027 50 0000 C CNN -F 2 "" H 3700 3200 50 0001 C CNN -F 3 "" H 3700 3200 50 0001 C CNN - 1 3700 3200 - 1 0 0 -1 -$EndComp -Wire Wire Line - 3700 3200 3700 3100 -Connection ~ 3700 3100 -Wire Wire Line - 3700 2700 3700 2600 -Wire Wire Line - 5100 2600 5100 2700 -Wire Wire Line - 3700 2600 4000 2600 -Wire Wire Line - 3700 3100 5100 3100 -Wire Wire Line - 4300 2600 4500 2600 -$Comp -L Device:R R2 -U 1 1 5B5CC4D4 -P 4650 2600 -F 0 "R2" V 4443 2600 50 0000 C CNN -F 1 "10k" V 4534 2600 50 0000 C CNN -F 2 "Resistor_SMD:R_1206_3216Metric" V 4580 2600 50 0001 C CNN -F 3 "~" H 4650 2600 50 0001 C CNN -F 4 "RMCF1206JT10K0" V 4650 2600 50 0001 C CNN "mpn" - 1 4650 2600 - 0 1 1 0 -$EndComp -Wire Wire Line - 4800 2600 5100 2600 -$EndSCHEMATC diff --git a/test/doit/test_doit.py b/test/doit/test_doit.py deleted file mode 100644 index fc13192..0000000 --- a/test/doit/test_doit.py +++ /dev/null @@ -1,54 +0,0 @@ -import inspect -import os -import pathlib -from inspect import Parameter - -import ee.digikey.doit -import ee.kicad.doit -from ee.digikey.doit import * -from ee.ds import DataSetManager -from ee.kicad.doit import * - -logger = logging.getLogger(__name__) - -file_dir = pathlib.Path(__file__).parent -schematics_dir = file_dir / "schematics" - - -def exec_task(task): - targets = task["targets"] - for a in task["actions"]: - if isinstance(a, str): - cmd = a % dict(targets=" ".join(targets)) - ret = os.system(cmd) - assert (ret == 0) - else: - parameters = {} - for p in inspect.signature(a).parameters.values(): - if p.kind == Parameter.POSITIONAL_OR_KEYWORD and p.name == "targets": - parameters["targets"] = targets - - a(**parameters) - - -# noinspection SpellCheckingInspection -def test_doit(tmpdir, caplog): - dsm = DataSetManager(pathlib.Path(tmpdir) / "ee") - - dsm.register_ds("csv", "kicad-footprint", "kicad-footprint-mapping", - path=schematics_dir / "ee" / "kicad-footprint.csv") - - ee.kicad.doit.doit_config.configure(data_set_manager=dsm) - ee.kicad.doit.doit_config.change_data_sets_for_task(task_kicad_create_component_data_set, - lambda ds: ds + ["kicad-footprint"]) - - ee.kicad.doit.init(sch=schematics_dir / "schematic-1.sch", - kicad_pcb=schematics_dir / "schematic-1.kicad_pcb", ) - - ee.digikey.doit.doit_config.configure(data_set_manager=dsm) - - exec_task(task_kicad_sch_to_data_set()) - exec_task(task_kicad_pcb_to_data_set()) - exec_task(task_kicad_create_component_data_set()) - exec_task(task_digikey_resolve_schematic_components()) - exec_task(task_digikey_fetch_full_part_facts()) |