From e934f8b459be826dfaa4f8561b0b215c15eff866 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 23 May 2020 20:36:11 -0400 Subject: [PATCH] Remove python netlist QA facilities --- eeschema/files-io.cpp | 10 ----- eeschema/sch_edit_frame.cpp | 13 ------ eeschema/sch_edit_frame.h | 7 --- qa/eeschema/test_netlists.py | 85 ------------------------------------ 4 files changed, 115 deletions(-) delete mode 100644 qa/eeschema/test_netlists.py diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 441ab7a75a..48e879a4a7 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -512,16 +512,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in m_infoBar->ShowMessage( "Schematic file is read only.", wxICON_WARNING ); } - // If requested, generate a netlist and exit immediately. - // NOTE: This is intended as a developer-only feature for now, and can be removed in lieu of - // Python scripting once that is possible. - if( m_generateNetlistAndExit ) - { - wxLogDebug( wxT( "Writing netlist to %s and exiting..." ), m_netlistFilename ); - WriteNetListFile( NET_TYPE_PCBNEW, m_netlistFilename, 0, nullptr ); - Close( false ); - } - return true; } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 0f0c9146a9..15e2f3f82e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -218,9 +218,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_findReplaceDialog = nullptr; - m_generateNetlistAndExit = false; - m_netlistFilename = wxEmptyString; - SetSpiceAdjustPassiveValues( false ); // Give an icon @@ -778,16 +775,6 @@ void SCH_EDIT_FRAME::LoadProject() } -void SCH_EDIT_FRAME::ParseArgs( wxCmdLineParser& aParser ) -{ - aParser.AddOption( "n", "netlist" ); - aParser.Parse(); - - if( aParser.Found( "netlist", &m_netlistFilename ) ) - m_generateNetlistAndExit = true; -} - - void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event ) { wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 009d6a0a33..6bb58803fc 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -149,11 +149,6 @@ private: static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type. - // NOTE: This is a developer-only feature and can be replaced by appropriate Python - // functionality once that is possible. - bool m_generateNetlistAndExit; ///< For command-line netlist generation - wxString m_netlistFilename; - protected: /** * Save the schematic files that have been modified and not yet saved. @@ -557,8 +552,6 @@ public: wxString GetCurrentFileName() const override; - void ParseArgs( wxCmdLineParser& aParser ) override; - /** * Import a KiCad schematic into the current sheet. * diff --git a/qa/eeschema/test_netlists.py b/qa/eeschema/test_netlists.py deleted file mode 100644 index d0050daaa8..0000000000 --- a/qa/eeschema/test_netlists.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python3 - -# This program source code file is part of KiCad, a free EDA CAD application. -# -# Copyright (C) 2020 Jon Evans -# Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# - -import argparse -import os -import subprocess -import sys - - -if __name__ == '__main__': - - parser = argparse.ArgumentParser(description='Tests eeschema netlist generation') - parser.add_argument('--initialize', action='store_true', - help='Generates the "good" reference netlists for each test case') - parser.add_argument('binary_dir', default='.') - - args = parser.parse_args() - - eeschema = os.path.abspath(os.path.join(args.binary_dir, 'eeschema/eeschema')) - - print('eeschema binary: {}'.format(eeschema)) - - # The way we discover testcases is simple: - # - # The root directory is hardcoded as ./data/netlists - # Inside that are testcases in folders. - # - # Each testcase must have the root sheet named the same as the folder, for example: - # ./data/netlists/video/video.sch - # - # The good netlist will be stored as ./data/netlists/video/video.net - # The test netlist will be generated as ./data/netlists/video/video_test.net - - data_dir = os.path.join(os.getcwd(), 'data/netlists') - - with os.scandir(data_dir) as it: - for entry in it: - if entry.is_dir(): - - project = entry.name - project_dir = os.path.join(data_dir, project) - - sch_file = os.path.join(project_dir, project + '.kicad_sch') - good_net_file = os.path.join(project_dir, project + '.net') - - net_file = good_net_file if args.initialize else os.path.join( - project_dir, project + '_test.net') - - if not os.path.exists(good_net_file) and not args.initialize: - print("FAILED: {} missing good netlist file for comparison".format(project)) - sys.exit(-1) - - subprocess.run([eeschema, '--netlist', net_file, sch_file], cwd=project_dir) - - result = subprocess.run(['./netdiff.py', good_net_file, net_file], - stdout=subprocess.PIPE) - - if not args.initialize: - os.remove(net_file) - - if result.returncode != 0: - print("FAILED: {} netlist does not match:".format(project)) - print(result.stdout) - - sys.exit(result.returncode) - - sys.exit(0)