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 # AcePerl support is deprecated, per LDS - cjfields - 5-5-2011
53 # 'Access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace'],
55 'Algorithm::Munkres' => [ 0, 'Phylogenetic Networks/Bio::PhyloNetwork' ],
57 'Array::Compare' => [ 0, 'Phylogenetic Networks/Bio::PhyloNetwork' ],
59 # this won't actually install due to circular dep, but we have no way of
60 # doing a post-install the [circular dependency!] specifies it is only
61 # installed on explicit request for this specific module, not when simply
62 # choosing to install 'all' modules
64 #'Bio::ASN1::EntrezGene' => [0,
65 # 'Parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]'],
69 'NeXML related modules/Bio::AlignIO::nexml,Bio::Nexml::Factory,'
70 . 'Bio::SeqIO::nexml,Bio::TreeIO::nexml'
73 'Clone' => [ 0, 'Cloning objects/Bio::Root::Root,Bio::Tools::Primer3' ],
75 'Convert::Binary::C' =>
76 [ 0, 'Strider functionality/Bio::SeqIO::strider' ],
78 'DB_File' => [ 0, 'Database functionality/Bio::Assemby,Bio::DB' ],
81 0, 'OO-based exception handling (very optional)/Bio::Root::Exception'
84 'HTML::TableExtract' => [
85 0, 'HTML parsing/Bio::DB::SeqVersion::gi'
88 'GD' => [ 0, 'Alignment graphic output/Bio::Align::Graphics' ],
92 'Phylogenetic Networks, ontology engine implementation, contig analysis'
93 . '/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,'
94 . 'Bio::Assembly::Tools::ContigSpectrum'
98 0, 'Phylogenetic Network Visualization/Bio::PhyloNetwork::GraphViz'
102 [ 0, 'Remote analysis POST submissions/Bio::SearchIO::blastxml' ],
104 'HTML::HeadParser' => [
106 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'
109 'HTML::TableExtract' =>
110 [ 0, 'Parsing HTML tables/Bio::DB::SeqVersion::gi' ],
112 'HTTP::Request::Common' => [
114 'GenBank+GenPept sequence retrieval, remote http Blast jobs'
115 . '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'
116 . 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'
119 'Inline::C' => [ 0.67, 'Speeding up code like Fasta Bio::DB::Fasta' ],
122 0, 'Deal with non-seekable filehandles/Bio::Tools::GuessSeqFormat'
125 'List::MoreUtils' => [
127 'Back- or reverse-translation of sequences/'
128 . 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'
131 'LWP::UserAgent' => [
133 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'
136 'PostScript::TextBlock' => [ 0, 'EPS output/Bio::Tree::Draw::Cladogram' ],
138 'Set::Scalar' => [ 0, 'Proper operation/Bio::Tree::Compatible' ],
140 'SOAP::Lite' => [ 0, 'Bibliographic queries/Bio::DB::Biblio::soap' ],
142 'Sort::Naturally' => [
144 'Sort lexically, but sort numeral parts numerically/'
145 . 'Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr'
148 'Spreadsheet::ParseExcel' =>
149 [ 0, 'Parsing Excel files/Bio::SeqIO::excel' ],
153 'Storing sequence objects in local file cache/'
154 . 'Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,'
155 . 'Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb,Bio::Root::Root'
158 'SVG' => [ 2.26, 'Creating SVG images/Bio::Draw::Pictogram' ],
160 'SVG::Graph' => [ 0.01, 'Creating SVG images/Bio::TreeIO::svggraph' ],
162 'Text::ParseWords' =>
163 [ 0, 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader' ],
165 'XML::DOM' => [ 0, 'Parsing XML/Bio::SeqIO::bsml,Bio::SeqIO::interpro' ],
167 'XML::DOM::XPath' => [ 0, 'Parsing XML/Bio::SeqIO::interpro' ],
170 [ 0, 'Parsing XML/Bio::SeqIO::seqxml,Bio::TreeIO::phyloxml' ],
172 'XML::Parser' => [ 0, 'Parsing XML/Bio::Biblio::IO::medlinexml' ],
174 'XML::Parser::PerlSAX' => [
176 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
177 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'
182 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'
185 'XML::SAX::Writer' => [ 0, 'Writing XML/Bio::SeqIO::tigrxml' ],
189 'Reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery'
194 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,'
195 . 'Bio::DB::Biblio::eutils'
200 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'
201 . 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'
202 . 'Bio::SearchIO::Writer::BSMLResultWriter'
205 'YAML' => [ 0, 'GenBank->GFF3/bp_genbank2gff3.pl' ],
210 my @drivers = available_drivers
();
212 # Set up the Bio::Root::Build object
213 my $build = Bio
::Root
::Build
->new(
214 module_name
=> 'Bio',
215 dist_name
=> 'BioPerl',
216 dist_version
=> '1.006925',
217 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
218 dist_abstract
=> 'Bioinformatics Toolkit',
222 'IO::String' => 0, # why is this required?
223 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
224 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
225 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
230 'Module::Build' => 0.2805,
231 'Test::Harness' => 2.62,
237 # reverted to a simple Module::Build-compatible hash, but we keep
238 # additional data in the %recommends hash above. May be converted to
239 # something simpler if there aren't complaints down the line.
240 map { $_ => $recommends{$_}[0] } sort keys %recommends
245 network
=> {} # say 'perl Build.PL --network' to manually request network tests
250 description
=> "Presence of Bio::ASN1::EntrezGene",
251 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
255 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
256 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
259 'Bio::DB::GFF Tests' => {
261 "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
262 requires
=> { 'DBI' => 0 },
267 "MySQL-related tests for Bio::DB::SeqFeature::Store",
268 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
273 "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
274 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0 },
279 "SQLite-related tests for Bio::DB::SeqFeature::Store",
280 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0 },
284 description
=> "Enable tests that need an internet connection",
285 requires
=> { 'LWP::UserAgent' => 0 },
289 recursive_test_files
=> 1,
291 # Extra files needed for BioPerl modules
293 './Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'
296 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
297 #script_files => [] # scripts in scripts directory are installed on-demand
300 my $accept = $build->args('accept');
302 my $proceed = prompt_for_biodb
($accept)
303 if $build->feature('Bio::DB::GFF')
304 || $build->feature('MySQL Tests')
305 || $build->feature('Pg Tests')
306 || $build->feature('SQLite Tests');
308 # Handle auto features
309 if ( $proceed && $build->feature('DB_File Tests') ) {
311 # will return without doing anything if user chose not to run tests during
315 && ( $build->feature('MySQL Tests')
316 || $build->feature('Pg Tests')
317 || $build->feature('SQLite Tests') )
323 $build->choose_scripts($accept);
325 if ( $build->args('network') ) {
326 if ( $build->feature('Network Tests') ) {
327 $build->notes( network
=> 1 );
328 $build->log_info(" - will run internet-requiring tests\n");
330 $build->notes( network
=> 0 );
332 " - Missing LWP::UserAgent, can't run network tests\n");
335 $build->prompt_for_network($accept) if $build->feature('Network Tests');
338 # Add additional files here
339 $build->add_build_element('xml');
341 # Create the build script and exit
342 $build->create_build_script;
346 ########################## Helper subs ##########################
349 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
350 my $path = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature_BDB.t' );
351 unlink($path) if ( -e
$path );
352 open my $F, '>', $path or die "Could not write test file '$path': $!\n";
354 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
357 $build->add_to_cleanup($path);
359 #$build->add_to_manifest_skip($path);
362 sub available_drivers
{
363 eval { require DBI
; 1; }; # if not installed, this sub won't actually be called
365 @drivers = DBI
->available_drivers;
366 unless ( grep {/mysql|Pg|SQLite/i} @drivers ) {
369 "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
376 my $dsn = $build->notes('test_dsn') || return;
377 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
378 my $driver = $build->notes('dbd_driver');
379 my $path = File
::Spec
->catfile( 't', 'LocalDB',
380 ( $driver eq 'mysql' ) ?
'SeqFeature_mysql.t'
381 : ( $driver eq 'SQLite' ) ?
'SeqFeature_SQLite.t'
382 : 'SeqFeature_Pg.t' );
383 my $test_db = $build->notes('test_db');
384 my $user = $build->notes('test_user');
385 my $pass = $build->notes('test_pass');
386 open my $F, '>', $path
387 or die "Could not write file '$path' for DBI test: $!\n";
388 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
389 $str .= " -user $user" if $user;
390 $str .= " -password $pass" if $pass;
395 $build->add_to_cleanup($path);
396 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
398 #$build->add_to_manifest_skip($path);
402 eval { require DBI
; }; # if not installed, this sub won't actually be called
404 @drivers = DBI
->available_drivers;
405 unless ( grep {/mysql|Pg|Oracle/i} @drivers ) {
406 return "MySQL, Pg nor Oracle DBI drivers are installed";
411 sub prompt_for_biodb
{
413 my $proceed = $accept ?
0 : $build->y_n(
414 "Do you want to run the Bio::DB::GFF or "
415 . "Bio::DB::SeqFeature::Store live database tests? " . "y/n",
421 foreach my $poss ( 'SQLite', 'mysql', 'Pg', 'Oracle' ) {
422 if ( grep {/$poss/i} @drivers ) {
424 $choice =~ s/^(.)/[$1]/;
425 push( @driver_choices, $choice );
430 if ( @driver_choices > 1 ) {
431 my ($default) = $driver_choices[0] =~ /\[(.)/;
432 $driver = $build->prompt(
433 "Which database driver should be used? "
434 . join( " ", @driver_choices ),
438 ($driver) = $driver_choices[0] =~ /\[(.)/;
440 if ( $driver =~ /^[mM]/ ) {
442 } elsif ( $driver =~ /^[pP]/ ) {
444 } elsif ( $driver =~ /^[oO]/ ) {
446 } elsif ( $driver =~ /^[sS]/ ) {
450 my $test_db = $build->prompt(
451 "Which database should I use for testing the $driver driver?\n"
452 . "This database should already be present but doesn't have to "
453 . "be preloaded for any schema",
456 my $test_host = $build->prompt(
457 "On which host is database '$test_db' running (hostname, ip address or host:port)",
460 my $test_user = $build->prompt(
461 "User name for connecting to database '$test_db'?", 'undef' );
462 my $test_pass = $build->prompt(
463 "Password for connecting to database '$test_db'?", 'undef' );
466 if ( $test_host eq 'undef' || $test_host eq 'localhost' ) {
471 if ( $driver eq 'Pg' || $driver eq 'SQLite' ) {
472 $test_dsn = "dbi:$driver:dbname=$test_db";
475 $test_dsn = "dbi:$driver:database=$test_db";
479 $test_dsn .= ";host=$test_host";
482 $build->notes( dbd_driver
=> $driver );
483 $build->notes( test_db
=> $test_db );
484 $build->notes( test_host
=> $test_host );
486 test_user
=> $test_user eq 'undef' ?
undef : $test_user );
488 test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass );
489 $build->notes( test_dsn
=> $test_dsn );
492 " - will run tests with database driver '$driver' and these settings:\n",
493 " Database $test_db\n",
494 " Host $test_host\n",
496 " User $test_user\n",
497 " Password $test_pass\n"
499 $build->log_info( " - will not run the BioDBSeqFeature live "
500 . "database tests (requires MySQL or Pg driver)\n" )
501 unless ( $driver eq 'mysql' or $driver eq 'Pg' );
504 " - will not run the BioDBGFF or BioDBSeqFeature live database tests\n"
508 $build->log_info("\n");