Refined what is filtered from the CSV comparisson in KiCost tests

This commit is contained in:
Salvador E. Tropea 2021-04-25 11:16:40 -03:00
parent 496de2712f
commit f27dc68e4f
7 changed files with 27 additions and 6 deletions

View File

@ -3,11 +3,14 @@
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,5.1.9+dfsg1-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Arrow,,,,,Digi-Key,,,,,Farnell,,,,,LCSC,,,,,Mouser,,,,,Newark,,,,,RS Components,,,,,TME,,,,,test,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
R1 R2,1k,1000,1%,,,Bourns,CR0603-JW-102ELF,100,0,0,,,,,,51387,,0,0,CR0603-JW-102ELFCT-ND,55000,,0,0,2333561,,,,,,52251,,0,0,652CR0603JW102ELF,110000,,0,0,02J2284,,,,,,,,,,,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,,0,,0,
,USD($)/GBP(£):,1.375941592305018,,,,,,,Purchase description:,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Created:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
3 Variant: default Unit Cost: 0
4 Revision: A Total Cost: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 Date: 2021-04-06
6 KiCad Version: 5.1.9+dfsg1-1
7 Global Part Info Arrow Digi-Key Farnell LCSC Mouser Newark RS Components TME test
8 References Value Real value Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 R1 R2 1k 1000 1% Bourns CR0603-JW-102ELF 100 0 0 51387 0 0 CR0603-JW-102ELFCT-ND 55000 0 0 2333561 52251 0 0 652CR0603JW102ELF 110000 0 0 02J2284
10 USD($)/GBP(£): Used currency rates: 1.375941592305018 Purchase description: Total Purchase: 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 0 0
11 USD($)/GBP(£): 1.375941592305018 Purchase description: 0 0 0 0 0 0 0 0 0
12 0
13 Created:
14 KiCost
15
16

View File

@ -3,12 +3,15 @@
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,5.1.9+dfsg1-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Arrow,,,,,Digi-Key,,,,,Farnell,,,,,LCSC,,,,,Mouser,,,,,Newark,,,,,RS Components,,,,,TME,,,,,test,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
C1 C2,1nF, 1000pF,20%,50 V 100 V,,Samsung,CL10B102KC8NNNC,100,0,0,,,,,,NonStk,,0,0,1276-1131-1-ND,3860,,0,0,3013404,542250,,0,0,C153291,NonStk,,0,0,187CL10B102KC8NNNC,19600,,0,0,82AC9311,NonStk,,0,0,7665480,5789,,0,0,CL10B102KC8NNNC,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,,0,,0,
,USD($)/EUR(€):,1.1873,,,,,,,Purchase description:,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,USD($)/GBP(£):,1.375941592305018,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Created:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
3 Variant: default Unit Cost: 0
4 Revision: A Total Cost: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 Date: 2021-04-06
6 KiCad Version: 5.1.9+dfsg1-1
7 Global Part Info Arrow Digi-Key Farnell LCSC Mouser Newark RS Components TME test
8 References Value Real value Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 C1 C2 1nF 1000pF 20% 50 V 100 V Samsung CL10B102KC8NNNC 100 0 0 NonStk 0 0 1276-1131-1-ND 3860 0 0 3013404 542250 0 0 C153291 NonStk 0 0 187CL10B102KC8NNNC 19600 0 0 82AC9311 NonStk 0 0 7665480 5789 0 0 CL10B102KC8NNNC
10 USD($)/EUR(€): Used currency rates: 1.1873 Purchase description: Total Purchase: 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 0 0
11 USD($)/GBP(£): USD($)/EUR(€): 1.375941592305018 1.1873 Purchase description: 0 0 0 0 0 0 0 0 0
12 USD($)/GBP(£): 1.375941592305018 0
13 Created:
14 KiCost
15
16
17

View File

@ -1,9 +1,11 @@
Prj:,KiBom Test Schematic,,,,Board Qty:,100
Co.:,https://github.com/SchrodingersGat/KiBom,,,,Unit Cost:,0
Prj date:,mar 30 mar 2021 09:46:24,,,,Total Cost:,0
$ date:,,,,,,
Global Part Info,,,,,,
Refs,Value,Footprint,Manf#,Qty,Unit$,Ext$
C1,1nF,,,100,,0
R1,1k,,,100,,0
KiCost,,,,,,

1 Prj: KiBom Test Schematic Board Qty: 100
2 Co.: https://github.com/SchrodingersGat/KiBom Unit Cost: 0
3 Prj date: mar 30 mar 2021 09:46:24 Total Cost: 0
4 $ date:
5 Global Part Info
6 Refs Value Footprint Manf# Qty Unit$ Ext$
7 C1 1nF 100 0
8 R1 1k 100 0
9 KiCost
10
11

View File

@ -1,9 +1,11 @@
Prj:,KiBom Test Schematic,,,,Board Qty:,100
Co.:,https://github.com/SchrodingersGat/KiBom,,,,Unit Cost:,0
Prj date:,mar 30 mar 2021 09:46:24,,,,Total Cost:,0
$ date:,,,,,,
Global Part Info,,,,,,
Refs,Value,Footprint,Manf#,Qty,Unit$,Ext$
R1,1k,,,100,,0
R2,1000,,,100,,0
KiCost,,,,,,

1 Prj: KiBom Test Schematic Board Qty: 100
2 Co.: https://github.com/SchrodingersGat/KiBom Unit Cost: 0
3 Prj date: mar 30 mar 2021 09:46:24 Total Cost: 0
4 $ date:
5 Global Part Info
6 Refs Value Footprint Manf# Qty Unit$ Ext$
7 R1 1k 100 0
8 R2 1000 100 0
9 KiCost
10
11

View File

@ -1,6 +1,7 @@
Prj:,KiBom Test Schematic,,,,Board Qty:,100
Co.:,https://github.com/SchrodingersGat/KiBom,,,,Unit Cost:,0
Prj date:,mar 30 mar 2021 09:46:24,,,,Total Cost:,0
$ date:,,,,,,
Global Part Info,,,,,,
Refs,Value,Footprint,Manf#,Qty,Unit$,Ext$
C2,1000 pF,,,100,,0
@ -8,3 +9,4 @@ R1,1k,,,100,,0
R2,1000,,,100,,0
KiCost,,,,,,

1 Prj: KiBom Test Schematic Board Qty: 100
2 Co.: https://github.com/SchrodingersGat/KiBom Unit Cost: 0
3 Prj date: mar 30 mar 2021 09:46:24 Total Cost: 0
4 $ date:
5 Global Part Info
6 Refs Value Footprint Manf# Qty Unit$ Ext$
7 C2 1000 pF 100 0
9 R2 1000 100 0
10 KiCost
11
12

View File

@ -1,6 +1,7 @@
Prj:,KiBom Test Schematic,,,,Board Qty:,100
Co.:,https://github.com/SchrodingersGat/KiBom,,,,Unit Cost:,0
Prj date:,mar 30 mar 2021 09:46:24,,,,Total Cost:,0
$ date:,,,,,,
Global Part Info,,,,,,
Refs,Value,Footprint,Manf#,Qty,Unit$,Ext$
C1,1nF,,,100,,0
@ -8,3 +9,4 @@ C2,1000 pF,,,100,,0
R1,3k3,,,100,,0
KiCost,,,,,,

1 Prj: KiBom Test Schematic Board Qty: 100
2 Co.: https://github.com/SchrodingersGat/KiBom Unit Cost: 0
3 Prj date: mar 30 mar 2021 09:46:24 Total Cost: 0
4 $ date:
5 Global Part Info
6 Refs Value Footprint Manf# Qty Unit$ Ext$
7 C1 1nF 100 0
9 R1 3k3 100 0
10 KiCost
11
12

View File

@ -7,6 +7,7 @@ pytest-3 --log-cli-level debug
import os.path as op
import sys
import re
# Look for the 'utils' module from where the script is running
prev_dir = op.dirname(op.dirname(op.abspath(__file__)))
if prev_dir not in sys.path:
@ -29,10 +30,16 @@ def convert2csv(xlsx, skip_empty=False, sheet=None):
if sheet:
cmd.extend(['-n', sheet])
cmd.append(xlsx)
p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE)
with open(csv, 'w') as f:
p2 = subprocess.Popen(['egrep', '-i', '-v', r'(\$ date|created|kicost|Total purchase)'], stdin=p1.stdout, stdout=f)
p2.communicate()[0]
cmd.append(csv)
subprocess.check_output(cmd)
with open(csv, 'rt') as f:
content = f.read()
content = re.sub(r'\$ date:,[^,]+', '$ date:,', content, 1)
content = re.sub(r'KiCost[^,]+', 'KiCost', content, 1)
content = re.sub(r'KiCad Version:,[^,]+', 'KiCad Version:,', content)
content = re.sub(r'Created:,[^,]+', 'Created:,', content, 1)
with open(csv, 'wt') as f:
f.write(content)
def check_simple(ctx, variant):