From 894ff92c770320e264961bba55bbf0fba16efe56 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 23 Jul 2018 22:53:17 +0200 Subject: wip. o Support for loading CSV files. --- test/doit/schematics/ee/kicad-footprint.csv | 45 +++++++++++++++++++++++++++++ test/doit/test_doit.py | 25 +++++++++++----- 2 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 test/doit/schematics/ee/kicad-footprint.csv (limited to 'test/doit') diff --git a/test/doit/schematics/ee/kicad-footprint.csv b/test/doit/schematics/ee/kicad-footprint.csv new file mode 100644 index 0000000..fa5cd5f --- /dev/null +++ b/test/doit/schematics/ee/kicad-footprint.csv @@ -0,0 +1,45 @@ +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/test_doit.py b/test/doit/test_doit.py index 4076af8..8c98345 100644 --- a/test/doit/test_doit.py +++ b/test/doit/test_doit.py @@ -1,16 +1,18 @@ import inspect -import logging import os import os.path +import logging +from pathlib import Path +from ee.fact import DataSetManager from inspect import Parameter - import ee.kicad.doit -from ee.kicad.doit import task_kicad_sch_to_data_set, task_kicad_pcb_to_data_set, task_kicad_create_component_data_set + +from ee.kicad.doit import * logger = logging.getLogger(__name__) -file_dir = os.path.dirname(os.path.abspath(__file__)) -schematics_dir = os.path.join(file_dir, "schematics") +file_dir = Path(__file__).parent +schematics_dir = file_dir / "schematics" def exec_task(task): @@ -31,9 +33,16 @@ def exec_task(task): # noinspection SpellCheckingInspection def test_doit(tmpdir, caplog): - ee.kicad.doit.init(sch=os.path.join(schematics_dir, "schematic-1.sch"), - kicad_pcb=os.path.join(schematics_dir, "schematic-1.kicad_pcb"), - data_set_dir=os.path.join(tmpdir, "ee"), ) + dsm = DataSetManager(os.path.join(tmpdir, "ee")) + + dsm.add_ds("csv", "kicad-footprint", "kicad-footprint-mapping", + path=schematics_dir / "ee" / "kicad-footprint.csv") + + ee.kicad.doit.change_data_sets_for_task(task_kicad_create_component_data_set, lambda ds: ds + ["kicad-footprint"]) + + ee.kicad.doit.init(data_set_manager=dsm, + sch=schematics_dir / "schematic-1.sch", + kicad_pcb=schematics_dir / "schematic-1.kicad_pcb",) exec_task(task_kicad_sch_to_data_set()) exec_task(task_kicad_pcb_to_data_set()) -- cgit v1.2.3