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 # this won't actually install due to circular dep, but we have no way of
51 # doing a post-install the [circular dependency!] specifies it is only
52 # installed on explicit request for this specific module, not when simply
53 # choosing to install 'all' modules
55 #'Bio::ASN1::EntrezGene' => [0,
56 # 'Parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]'],
58 'Clone' => [ 0, 'Cloning objects/Bio::Root::Root,Bio::Tools::Primer3' ],
60 'Convert::Binary::C' =>
61 [ 0, 'Strider functionality/Bio::SeqIO::strider' ],
63 'DB_File' => [ 0, 'Database functionality/Bio::DB' ],
66 0, 'OO-based exception handling (very optional)/Bio::Root::Exception'
71 'Phylogenetic Networks, ontology engine implementation, contig analysis'
72 . '/Bio::Ontology::SimpleGOEngine::GraphAdaptor'
76 [ 0, 'Remote analysis POST submissions/Bio::SearchIO::blastxml' ],
78 'HTML::HeadParser' => [
80 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'
83 'HTML::TableExtract' =>
84 [ 0, 'Parsing HTML tables/Bio::DB::SeqVersion::gi' ],
86 'HTTP::Request::Common' => [
88 'GenBank+GenPept sequence retrieval, remote http Blast jobs'
89 . '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'
90 . 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'
93 'Inline::C' => [ 0.67, 'Speeding up code like Fasta Bio::DB::Fasta' ],
96 0, 'Deal with non-seekable filehandles/Bio::Tools::GuessSeqFormat'
99 'List::MoreUtils' => [
101 'Back- or reverse-translation of sequences/'
102 . 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'
105 'LWP::UserAgent' => [
107 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'
110 'Set::Scalar' => [ 0, 'Proper operation/Bio::Tree::Compatible' ],
112 'Spreadsheet::ParseExcel' =>
113 [ 0, 'Parsing Excel files/Bio::SeqIO::excel' ],
117 'Storing sequence objects in local file cache/'
118 . 'Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,'
119 . 'Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb,Bio::Root::Root'
122 'SVG::Graph' => [ 0.01, 'Creating SVG images/Bio::TreeIO::svggraph' ],
124 'Text::ParseWords' =>
125 [ 0, 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader' ],
127 'XML::DOM' => [ 0, 'Parsing XML/Bio::SeqIO::bsml,Bio::SeqIO::interpro' ],
129 'XML::DOM::XPath' => [ 0, 'Parsing XML/Bio::SeqIO::interpro' ],
132 [ 0, 'Parsing XML/Bio::SeqIO::seqxml,Bio::TreeIO::phyloxml' ],
134 'XML::Parser' => [ 0, 'Parsing XML/Bio::OntologyIO::InterProParser' ],
136 'XML::Parser::PerlSAX' => [
138 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
139 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'
144 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'
147 'XML::SAX::Writer' => [ 0, 'Writing XML/Bio::SeqIO::tigrxml' ],
151 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez'
156 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'
157 . 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'
158 . 'Bio::SearchIO::Writer::BSMLResultWriter'
161 'YAML' => [ 0, 'GenBank->GFF3/bp_genbank2gff3.pl' ],
166 my @drivers = available_drivers
();
168 # Set up the Bio::Root::Build object
169 my $build = Bio
::Root
::Build
->new(
170 module_name
=> 'Bio',
171 dist_name
=> 'BioPerl',
172 dist_version
=> $Bio::Root
::Version
::VERSION
,
173 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
174 dist_abstract
=> 'Bioinformatics Toolkit',
178 'IO::String' => 0, # why is this required?
179 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
180 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
181 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
184 configure_requires
=> {
185 'Module::Build' => 0.42,
189 'Module::Build' => 0.42,
191 'Test::Harness' => 2.62,
197 # reverted to a simple Module::Build-compatible hash, but we keep
198 # additional data in the %recommends hash above. May be converted to
199 # something simpler if there aren't complaints down the line.
200 map { $_ => $recommends{$_}[0] } sort keys %recommends
205 network
=> {} # say 'perl Build.PL --network' to manually request network tests
210 description
=> "Presence of Bio::ASN1::EntrezGene",
211 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
215 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
216 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
219 'Bio::DB::GFF Tests' => {
221 "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
222 requires
=> { 'DBI' => 0 },
227 "MySQL-related tests for Bio::DB::SeqFeature::Store",
228 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
233 "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
234 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0 },
239 "SQLite-related tests for Bio::DB::SeqFeature::Store",
240 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0 },
244 description
=> "Enable tests that need an internet connection",
245 requires
=> { 'LWP::UserAgent' => 0 },
249 recursive_test_files
=> 1,
251 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
252 #script_files => [] # scripts in scripts directory are installed on-demand
255 my $accept = $build->args('accept');
257 my $proceed = prompt_for_biodb
($accept)
258 if $build->feature('Bio::DB::GFF')
259 || $build->feature('MySQL Tests')
260 || $build->feature('Pg Tests')
261 || $build->feature('SQLite Tests');
263 # Handle auto features
264 if ( $proceed && $build->feature('DB_File Tests') ) {
266 # will return without doing anything if user chose not to run tests during
270 && ( $build->feature('MySQL Tests')
271 || $build->feature('Pg Tests')
272 || $build->feature('SQLite Tests') )
278 $build->choose_scripts($accept);
280 if ( $build->args('network') ) {
281 if ( $build->feature('Network Tests') ) {
282 $build->notes( network
=> 1 );
283 $build->log_info(" - will run internet-requiring tests\n");
285 $build->notes( network
=> 0 );
287 " - Missing LWP::UserAgent, can't run network tests\n");
290 $build->prompt_for_network($accept) if $build->feature('Network Tests');
293 # Add additional files here
294 $build->add_build_element('xml');
296 if ( ! -e
'MANIFEST' ) {
297 $build->ACTION_manifest();
300 # Create the build script and exit
301 $build->create_build_script();
305 ########################## Helper subs ##########################
308 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
309 my $path = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature_BDB.t' );
310 unlink($path) if ( -e
$path );
311 open my $F, '>', $path or die "Could not write test file '$path': $!\n";
313 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
316 $build->add_to_cleanup($path);
318 #$build->add_to_manifest_skip($path);
321 sub available_drivers
{
322 eval { require DBI
; 1; }; # if not installed, this sub won't actually be called
324 @drivers = DBI
->available_drivers;
325 unless ( grep {/mysql|Pg|SQLite/i} @drivers ) {
328 "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
335 my $dsn = $build->notes('test_dsn') || return;
336 my $path0 = File
::Spec
->catfile( 't', 'LocalDB', 'SeqFeature.t' );
337 my $driver = $build->notes('dbd_driver');
338 my $path = File
::Spec
->catfile( 't', 'LocalDB',
339 ( $driver eq 'mysql' ) ?
'SeqFeature_mysql.t'
340 : ( $driver eq 'SQLite' ) ?
'SeqFeature_SQLite.t'
341 : 'SeqFeature_Pg.t' );
342 my $test_db = $build->notes('test_db');
343 my $user = $build->notes('test_user');
344 my $pass = $build->notes('test_pass');
345 open my $F, '>', $path
346 or die "Could not write file '$path' for DBI test: $!\n";
347 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
348 $str .= " -user $user" if $user;
349 $str .= " -password $pass" if $pass;
354 $build->add_to_cleanup($path);
355 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
357 #$build->add_to_manifest_skip($path);
361 eval { require DBI
; }; # if not installed, this sub won't actually be called
363 @drivers = DBI
->available_drivers;
364 unless ( grep {/mysql|Pg|Oracle/i} @drivers ) {
365 return "MySQL, Pg nor Oracle DBI drivers are installed";
370 sub prompt_for_biodb
{
372 my $proceed = $accept ?
0 : $build->y_n(
373 "Do you want to run the Bio::DB::GFF or "
374 . "Bio::DB::SeqFeature::Store live database tests? " . "y/n",
380 foreach my $poss ( 'SQLite', 'mysql', 'Pg', 'Oracle' ) {
381 if ( grep {/$poss/i} @drivers ) {
383 $choice =~ s/^(.)/[$1]/;
384 push( @driver_choices, $choice );
389 if ( @driver_choices > 1 ) {
390 my ($default) = $driver_choices[0] =~ /\[(.)/;
391 $driver = $build->prompt(
392 "Which database driver should be used? "
393 . join( " ", @driver_choices ),
397 ($driver) = $driver_choices[0] =~ /\[(.)/;
399 if ( $driver =~ /^[mM]/ ) {
401 } elsif ( $driver =~ /^[pP]/ ) {
403 } elsif ( $driver =~ /^[oO]/ ) {
405 } elsif ( $driver =~ /^[sS]/ ) {
409 my $test_db = $build->prompt(
410 "Which database should I use for testing the $driver driver?\n"
411 . "This database should already be present but doesn't have to "
412 . "be preloaded for any schema",
415 my $test_host = $build->prompt(
416 "On which host is database '$test_db' running (hostname, ip address or host:port)",
419 my $test_user = $build->prompt(
420 "User name for connecting to database '$test_db'?", 'undef' );
421 my $test_pass = $build->prompt(
422 "Password for connecting to database '$test_db'?", 'undef' );
425 if ( $test_host eq 'undef' || $test_host eq 'localhost' ) {
430 if ( $driver eq 'Pg' || $driver eq 'SQLite' ) {
431 $test_dsn = "dbi:$driver:dbname=$test_db";
434 $test_dsn = "dbi:$driver:database=$test_db";
438 $test_dsn .= ";host=$test_host";
441 $build->notes( dbd_driver
=> $driver );
442 $build->notes( test_db
=> $test_db );
443 $build->notes( test_host
=> $test_host );
445 test_user
=> $test_user eq 'undef' ?
undef : $test_user );
447 test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass );
448 $build->notes( test_dsn
=> $test_dsn );
451 " - will run tests with database driver '$driver' and these settings:\n",
452 " Database $test_db\n",
453 " Host $test_host\n",
455 " User $test_user\n",
456 " Password $test_pass\n"
458 $build->log_info( " - will not run the BioDBSeqFeature live "
459 . "database tests (requires MySQL or Pg driver)\n" )
460 unless ( $driver eq 'mysql' or $driver eq 'Pg' );
463 " - will not run the BioDBGFF or BioDBSeqFeature live database tests\n"
467 $build->log_info("\n");