3 # This is a Module::Build script for Bioperl installation.
4 # See http://search.cpan.org/~kwilliams/Module-Build/lib/Module/Build.pm
6 # Uses a custom subclass of Module::Build called Bio::Root::Build
8 # In the future developers may need to alter the requires and recommends
9 # sections of Bio::Root::Build->new() below, but otherwise nothing else here is
10 # likely to need changing.
16 # XML::SAX::RTF doesn't work with BioPerl, at all, nada, zilch.
18 # Since we're running into this now on CPAN Testers, catch it up front and
21 # See: https://rt.cpan.org/Ticket/Display.html?id=5943
22 # https://redmine.open-bio.org/issues/2975
25 eval { require XML
::SAX
; 1; };
28 if ( grep { $_->{Name
} =~ 'XML::SAX::RTF' } @
{ XML
::SAX
->parsers() } )
32 ############################# WARNING #############################
34 XML::SAX::RTF is not XML::SAX-compliant but is registered as an
35 XML::SAX parser. If used as the primary parser, modules requiring
36 XML::SAX will NOT work. Please install another XML::SAX-compliant
37 module and modify your local ParserDetails.ini file per XML::SAX
38 docs to remove references to XML::SAX::RTF.
40 ############################# WARNING #############################
50 'Algorithm::Munkres' => [ 0, 'Phylogenetic Networks/Bio::PhyloNetwork' ],
52 'Array::Compare' => [ 0, 'Phylogenetic Networks/Bio::PhyloNetwork' ],
54 # this won't actually install due to circular dep, but we have no way of
55 # doing a post-install the [circular dependency!] specifies it is only
56 # installed on explicit request for this specific module, not when simply
57 # choosing to install 'all' modules
59 #'Bio::ASN1::EntrezGene' => [0,
60 # 'Parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]'],
62 'CGI' => [ 0, 'CGI-y things/Bio::DB::Query::HIVQuery' ],
64 'Clone' => [ 0, 'Cloning objects/Bio::Root::Root,Bio::Tools::Primer3' ],
66 'Convert::Binary::C' =>
67 [ 0, 'Strider functionality/Bio::SeqIO::strider' ],
69 'DB_File' => [ 0, 'Database functionality/Bio::Assemby,Bio::DB' ],
72 0, 'OO-based exception handling (very optional)/Bio::Root::Exception'
75 'GD' => [ 0, 'Alignment graphic output/Bio::Align::Graphics' ],
79 'Phylogenetic Networks, ontology engine implementation, contig analysis'
80 . '/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,'
81 . 'Bio::Assembly::Tools::ContigSpectrum'
85 0, 'Phylogenetic Network Visualization/Bio::PhyloNetwork::GraphViz'
89 [ 0, 'Remote analysis POST submissions/Bio::SearchIO::blastxml' ],
91 'HTML::HeadParser' => [
93 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'
96 'HTML::TableExtract' =>
97 [ 0, 'Parsing HTML tables/Bio::DB::SeqVersion::gi' ],
99 'HTTP::Request::Common' => [
101 'GenBank+GenPept sequence retrieval, remote http Blast jobs'
102 . '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'
103 . 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'
106 'Inline::C' => [ 0.67, 'Speeding up code like Fasta Bio::DB::Fasta' ],
109 0, 'Deal with non-seekable filehandles/Bio::Tools::GuessSeqFormat'
112 'List::MoreUtils' => [
114 'Back- or reverse-translation of sequences/'
115 . 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'
118 'LWP::UserAgent' => [
120 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'
123 'PostScript::TextBlock' => [ 0, 'EPS output/Bio::Tree::Draw::Cladogram' ],
125 'Set::Scalar' => [ 0, 'Proper operation/Bio::Tree::Compatible' ],
127 'Sort::Naturally' => [
129 'Sort lexically, but sort numeral parts numerically/'
130 . 'Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr'
133 'Spreadsheet::ParseExcel' =>
134 [ 0, 'Parsing Excel files/Bio::SeqIO::excel' ],
138 'Storing sequence objects in local file cache/'
139 . 'Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,'
140 . 'Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb,Bio::Root::Root'
143 'SVG::Graph' => [ 0.01, 'Creating SVG images/Bio::TreeIO::svggraph' ],
145 'Text::ParseWords' =>
146 [ 0, 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader' ],
148 'XML::DOM' => [ 0, 'Parsing XML/Bio::SeqIO::bsml,Bio::SeqIO::interpro' ],
150 'XML::DOM::XPath' => [ 0, 'Parsing XML/Bio::SeqIO::interpro' ],
153 [ 0, 'Parsing XML/Bio::SeqIO::seqxml,Bio::TreeIO::phyloxml' ],
155 'XML::Parser' => [ 0, 'Parsing XML/Bio::OntologyIO::InterProParser' ],
157 'XML::Parser::PerlSAX' => [
159 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
160 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'
165 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'
168 'XML::SAX::Writer' => [ 0, 'Writing XML/Bio::SeqIO::tigrxml' ],
172 'Reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery'
177 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez'
182 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'
183 . 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'
184 . 'Bio::SearchIO::Writer::BSMLResultWriter'
187 'YAML' => [ 0, 'GenBank->GFF3/bp_genbank2gff3.pl' ],
192 my @drivers = available_drivers
();
194 # Set up the Bio::Root::Build object
195 my $build = Bio
::Root
::Build
->new(
196 module_name
=> 'Bio',
197 dist_name
=> 'BioPerl',
198 dist_version
=> $Bio::Root
::Version
::VERSION
,
199 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
200 dist_abstract
=> 'Bioinformatics Toolkit',
204 'IO::String' => 0, # why is this required?
205 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
206 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
207 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
210 configure_requires
=> {
211 'Module::Build' => 0.42,
215 'Module::Build' => 0.42,
217 'Test::Harness' => 2.62,
223 # reverted to a simple Module::Build-compatible hash, but we keep
224 # additional data in the %recommends hash above. May be converted to
225 # something simpler if there aren't complaints down the line.
226 map { $_ => $recommends{$_}[0] } sort keys %recommends
231 network
=> {} # say 'perl Build.PL --network' to manually request network tests
236 description
=> "Presence of Bio::ASN1::EntrezGene",
237 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
241 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
242 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
245 'Bio::DB::GFF Tests' => {
247 "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
248 requires
=> { 'DBI' => 0 },
253 "MySQL-related tests for Bio::DB::SeqFeature::Store",
254 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
259 "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
260 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0 },
265 "SQLite-related tests for Bio::DB::SeqFeature::Store",
266 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0 },
270 description
=> "Enable tests that need an internet connection",
271 requires
=> { 'LWP::UserAgent' => 0 },
275 recursive_test_files
=> 1,
277 # Extra files needed for BioPerl modules
279 './Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'
282 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
283 #script_files => [] # scripts in scripts directory are installed on-demand
286 my $accept = $build->args('accept');
288 my $proceed = prompt_for_biodb
($accept)
289 if $build->feature('Bio::DB::GFF')
290 || $build->feature('MySQL Tests')
291 || $build->feature('Pg Tests')
292 || $build->feature('SQLite Tests');
294 # Handle auto features
295 if ( $proceed && $build->feature('DB_File Tests') ) {
297 # will return without doing anything if user chose not to run tests during
301 && ( $build->feature('MySQL Tests')
302 || $build->feature('Pg Tests')
303 || $build->feature('SQLite Tests') )
309 $build->choose_scripts($accept);
311 if ( $build->args('network') ) {
312 if ( $build->feature('Network Tests') ) {
313 $build->notes( network
=> 1 );
314 $build->log_info(" - will run internet-requiring tests\n");
316 $build->notes( network
=> 0 );
318 " - Missing LWP::UserAgent, can't run network tests\n");
321 $build->prompt_for_network($accept) if $build->feature('Network Tests');
324 # Add additional files here
325 $build->add_build_element('xml');
327 if ( ! -e
'MANIFEST' ) {
328 $build->ACTION_manifest();
331 # Create the build script and exit
332 $build->create_build_script();
336 ########################## Helper subs ##########################
339 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
340 my $path = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature_BDB.t' );
341 unlink($path) if ( -e
$path );
342 open my $F, '>', $path or die "Could not write test file '$path': $!\n";
344 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
347 $build->add_to_cleanup($path);
349 #$build->add_to_manifest_skip($path);
352 sub available_drivers
{
353 eval { require DBI
; 1; }; # if not installed, this sub won't actually be called
355 @drivers = DBI
->available_drivers;
356 unless ( grep {/mysql|Pg|SQLite/i} @drivers ) {
359 "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
366 my $dsn = $build->notes('test_dsn') || return;
367 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
368 my $driver = $build->notes('dbd_driver');
369 my $path = File
::Spec
->catfile( 't', 'LocalDB',
370 ( $driver eq 'mysql' ) ?
'SeqFeature_mysql.t'
371 : ( $driver eq 'SQLite' ) ?
'SeqFeature_SQLite.t'
372 : 'SeqFeature_Pg.t' );
373 my $test_db = $build->notes('test_db');
374 my $user = $build->notes('test_user');
375 my $pass = $build->notes('test_pass');
376 open my $F, '>', $path
377 or die "Could not write file '$path' for DBI test: $!\n";
378 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
379 $str .= " -user $user" if $user;
380 $str .= " -password $pass" if $pass;
385 $build->add_to_cleanup($path);
386 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
388 #$build->add_to_manifest_skip($path);
392 eval { require DBI
; }; # if not installed, this sub won't actually be called
394 @drivers = DBI
->available_drivers;
395 unless ( grep {/mysql|Pg|Oracle/i} @drivers ) {
396 return "MySQL, Pg nor Oracle DBI drivers are installed";
401 sub prompt_for_biodb
{
403 my $proceed = $accept ?
0 : $build->y_n(
404 "Do you want to run the Bio::DB::GFF or "
405 . "Bio::DB::SeqFeature::Store live database tests? " . "y/n",
411 foreach my $poss ( 'SQLite', 'mysql', 'Pg', 'Oracle' ) {
412 if ( grep {/$poss/i} @drivers ) {
414 $choice =~ s/^(.)/[$1]/;
415 push( @driver_choices, $choice );
420 if ( @driver_choices > 1 ) {
421 my ($default) = $driver_choices[0] =~ /\[(.)/;
422 $driver = $build->prompt(
423 "Which database driver should be used? "
424 . join( " ", @driver_choices ),
428 ($driver) = $driver_choices[0] =~ /\[(.)/;
430 if ( $driver =~ /^[mM]/ ) {
432 } elsif ( $driver =~ /^[pP]/ ) {
434 } elsif ( $driver =~ /^[oO]/ ) {
436 } elsif ( $driver =~ /^[sS]/ ) {
440 my $test_db = $build->prompt(
441 "Which database should I use for testing the $driver driver?\n"
442 . "This database should already be present but doesn't have to "
443 . "be preloaded for any schema",
446 my $test_host = $build->prompt(
447 "On which host is database '$test_db' running (hostname, ip address or host:port)",
450 my $test_user = $build->prompt(
451 "User name for connecting to database '$test_db'?", 'undef' );
452 my $test_pass = $build->prompt(
453 "Password for connecting to database '$test_db'?", 'undef' );
456 if ( $test_host eq 'undef' || $test_host eq 'localhost' ) {
461 if ( $driver eq 'Pg' || $driver eq 'SQLite' ) {
462 $test_dsn = "dbi:$driver:dbname=$test_db";
465 $test_dsn = "dbi:$driver:database=$test_db";
469 $test_dsn .= ";host=$test_host";
472 $build->notes( dbd_driver
=> $driver );
473 $build->notes( test_db
=> $test_db );
474 $build->notes( test_host
=> $test_host );
476 test_user
=> $test_user eq 'undef' ?
undef : $test_user );
478 test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass );
479 $build->notes( test_dsn
=> $test_dsn );
482 " - will run tests with database driver '$driver' and these settings:\n",
483 " Database $test_db\n",
484 " Host $test_host\n",
486 " User $test_user\n",
487 " Password $test_pass\n"
489 $build->log_info( " - will not run the BioDBSeqFeature live "
490 . "database tests (requires MySQL or Pg driver)\n" )
491 unless ( $driver eq 'mysql' or $driver eq 'Pg' );
494 " - will not run the BioDBGFF or BioDBSeqFeature live database tests\n"
498 $build->log_info("\n");