Remove python netlist QA facilities

This commit is contained in:
Jon Evans 2020-05-23 20:36:11 -04:00
parent f730aa7834
commit e934f8b459
4 changed files with 0 additions and 115 deletions

View File

@ -512,16 +512,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& 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;
}

View File

@ -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() );

View File

@ -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.
*

View File

@ -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 <jon@craftyjon.com>
# 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 <http://www.gnu.org/licenses/>.
#
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)