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
24 { eval { require XML
::SAX
; 1; };
27 if (grep {$_->{Name
} =~ 'XML::SAX::RTF'} @
{XML
::SAX
->parsers()}) {
30 ############################# WARNING #############################
32 XML::SAX::RTF is not XML::SAX-compliant but is registered as an
33 XML::SAX parser. If used as the primary parser, modules requiring
34 XML::SAX will NOT work. Please install another XML::SAX-compliant
35 module and modify your local ParserDetails.ini file per XML::SAX
36 docs to remove references to XML::SAX::RTF.
38 ############################# WARNING #############################
48 # AcePerl support is deprecated, per LDS - cjfields - 5-5-2011
51 # 'Access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace'],
53 'Algorithm::Munkres' => [0,
54 'Phylogenetic Networks/Bio::PhyloNetwork'],
56 'Array::Compare' => [0,
57 '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!]'],
68 'NeXML related modules/Bio::AlignIO::nexml,Bio::Nexml::Factory,'.
69 'Bio::SeqIO::nexml,Bio::TreeIO::nexml'],
72 'Cloning objects/Bio::Root::Root,Bio::Tools::Primer3'],
74 'Convert::Binary::C' => [0,
75 'Strider functionality/Bio::SeqIO::strider'],
78 'Database functionality/Bio::Assemby,Bio::DB'],
81 'OO-based exception handling (very optional)/Bio::Root::Exception'],
84 'Alignment graphic output/Bio::Align::Graphics'],
87 'Phylogenetic Networks, ontology engine implementation, contig analysis'.
88 '/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,'.
89 'Bio::Assembly::Tools::ContigSpectrum'],
92 'Phylogenetic Network Visualization/Bio::PhyloNetwork::GraphViz'],
94 'HTML::Entities' => [0,
95 'Remote analysis POST submissions/Bio::SearchIO::blastxml'],
97 'HTML::HeadParser' => [3,
98 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'],
100 'HTML::TableExtract' => [0,
101 'Parsing HTML tables/Bio::DB::SeqVersion::gi'],
103 'HTTP::Request::Common' => [0,
104 'GenBank+GenPept sequence retrieval, remote http Blast jobs'.
105 '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'.
106 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'],
108 'Inline::C' => [0.67,
109 'Speeding up code like Fasta Bio::DB::Fasta'],
112 'Deal with non-seekable filehandles/Bio::Tools::GuessSeqFormat'],
114 'List::MoreUtils' => [0,
115 'Back- or reverse-translation of sequences/'.
116 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'],
118 'LWP::UserAgent' => [0,
119 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'],
121 'PostScript::TextBlock' => [0,
122 'EPS output/Bio::Tree::Draw::Cladogram'],
125 'Proper operation/Bio::Tree::Compatible'],
128 'Bibliographic queries/Bio::DB::Biblio::soap'],
130 'Sort::Naturally' => [0,
131 'Sort lexically, but sort numeral parts numerically/'.
132 'Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr'],
134 'Spreadsheet::ParseExcel' => [0,
135 '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 'Creating SVG images/Bio::Draw::Pictogram'],
145 'SVG::Graph' => [0.01,
146 'Creating SVG images/Bio::TreeIO::svggraph'],
148 'Text::ParseWords' => [0,
149 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader'],
152 'Parsing XML/Bio::SeqIO::bsml,Bio::SeqIO::interpro'],
154 'XML::DOM::XPath' => [0,
155 'Parsing XML/Bio::SeqIO::interpro'],
158 'Parsing XML/Bio::SeqIO::seqxml,Bio::TreeIO::phyloxml'],
161 'Parsing XML/Bio::Biblio::IO::medlinexml'],
163 'XML::Parser::PerlSAX' => [0,
164 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
165 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'],
168 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'],
170 'XML::SAX::Writer' => [0,
171 'Writing XML/Bio::SeqIO::tigrxml'],
174 'Reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery'],
177 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,'.
178 'Bio::DB::Biblio::eutils'],
180 'XML::Writer' => [0.4,
181 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'.
182 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'.
183 'Bio::SearchIO::Writer::BSMLResultWriter'],
186 'GenBank->GFF3/bp_genbank2gff3.pl'],
191 my @drivers = available_drivers
();
193 # Set up the Bio::Root::Build object
194 my $build = Bio
::Root
::Build
->new(
195 module_name
=> 'Bio',
196 dist_name
=> 'BioPerl',
197 dist_version
=> '1.006925',
198 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
199 dist_abstract
=> 'Bioinformatics Toolkit',
203 'IO::String' => 0, # why is this required?
204 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
205 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
206 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
211 'Module::Build' => 0.2805,
212 'Test::Harness' => 2.62,
218 # reverted to a simple Module::Build-compatible hash, but we keep
219 # additional data in the %recommends hash above. May be converted to
220 # something simpler if there aren't complaints down the line.
221 map {$_ => $recommends{$_}[0]} sort keys %recommends
226 network
=> { } # say 'perl Build.PL --network' to manually request network tests
231 description
=> "Presence of Bio::ASN1::EntrezGene",
232 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
236 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
237 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
240 'Bio::DB::GFF Tests' => {
241 description
=> "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
242 requires
=> { 'DBI' => 0 },
246 description
=> "MySQL-related tests for Bio::DB::SeqFeature::Store",
247 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
251 description
=> "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
252 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0},
256 description
=> "SQLite-related tests for Bio::DB::SeqFeature::Store",
257 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0},
261 description
=> "Enable tests that need an internet connection",
262 requires
=> { 'LWP::UserAgent' => 0 },
266 recursive_test_files
=> 1,
268 # Extra files needed for BioPerl modules
269 xml_files
=> {'./Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'},
271 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
272 #script_files => [] # scripts in scripts directory are installed on-demand
275 my $accept = $build->args('accept');
277 my $proceed = prompt_for_biodb
($accept)
278 if $build->feature('Bio::DB::GFF') || $build->feature('MySQL Tests') ||
279 $build->feature('Pg Tests') || $build->feature('SQLite Tests');
281 # Handle auto features
282 if ($proceed && $build->feature('DB_File Tests')) {
283 # will return without doing anything if user chose not to run tests during
286 if ($proceed && ($build->feature('MySQL Tests') ||
287 $build->feature('Pg Tests') ||
288 $build->feature('SQLite Tests'))) {
293 $build->choose_scripts($accept);
295 if ($build->args('network')) {
296 if ($build->feature('Network Tests')) {
297 $build->notes(network
=> 1);
298 $build->log_info(" - will run internet-requiring tests\n");
301 $build->notes(network
=> 0);
302 $build->log_info(" - Missing LWP::UserAgent, can't run network tests\n");
306 $build->prompt_for_network($accept) if $build->feature('Network Tests');
309 # Add additional files here
310 $build->add_build_element('xml');
312 # Create the build script and exit
313 $build->create_build_script;
317 ########################## Helper subs ##########################
320 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
321 my $path = File
::Spec
->catfile('t', 'LocalDB','SeqFeature_BDB.t');
322 unlink($path) if (-e
$path);
323 open my $F, '>', $path or die "Could not write test file '$path': $!\n";
325 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
328 $build->add_to_cleanup($path);
329 #$build->add_to_manifest_skip($path);
332 sub available_drivers
{
333 eval {require DBI
; 1;}; # if not installed, this sub won't actually be called
335 @drivers = DBI
->available_drivers;
336 unless (grep {/mysql|Pg|SQLite/i} @drivers) {
338 return "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
345 my $dsn = $build->notes('test_dsn') || return;
346 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
347 my $driver = $build->notes('dbd_driver');
348 my $path = File
::Spec
->catfile('t', 'LocalDB',
349 ($driver eq 'mysql') ?
'SeqFeature_mysql.t' :
350 ($driver eq 'SQLite') ?
'SeqFeature_SQLite.t' :
352 my $test_db = $build->notes('test_db');
353 my $user = $build->notes('test_user');
354 my $pass = $build->notes('test_pass');
355 open my $F, '>', $path or die "Could not write file '$path' for DBI test: $!\n";
356 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
357 $str .= " -user $user" if $user;
358 $str .= " -password $pass" if $pass;
363 $build->add_to_cleanup($path);
364 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
365 #$build->add_to_manifest_skip($path);
369 eval {require DBI
;}; # if not installed, this sub won't actually be called
371 @drivers = DBI
->available_drivers;
372 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
373 return "MySQL, Pg nor Oracle DBI drivers are installed";
378 sub prompt_for_biodb
{
380 my $proceed = $accept ?
0 : $build->y_n("Do you want to run the Bio::DB::GFF or ".
381 "Bio::DB::SeqFeature::Store live database tests? ".
386 foreach my $poss ('SQLite', 'mysql', 'Pg', 'Oracle') {
387 if (grep {/$poss/i} @drivers) {
389 $choice =~ s/^(.)/[$1]/;
390 push(@driver_choices, $choice);
395 if (@driver_choices > 1) {
396 my ($default) = $driver_choices[0] =~ /\[(.)/;
397 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
400 ($driver) = $driver_choices[0] =~ /\[(.)/;
402 if ($driver =~ /^[mM]/) {
405 elsif ($driver =~ /^[pP]/) {
408 elsif ($driver =~ /^[oO]/) {
411 elsif ($driver =~ /^[sS]/) {
415 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?\n".
416 "This database should already be present but doesn't have to ".
417 "be preloaded for any schema", 'test');
418 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
419 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
420 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
423 if ($test_host eq 'undef' || $test_host eq 'localhost') {
428 if ($driver eq 'Pg' || $driver eq 'SQLite') {
429 $test_dsn = "dbi:$driver:dbname=$test_db";
433 $test_dsn = "dbi:$driver:database=$test_db";
437 $test_dsn .= ";host=$test_host";
440 $build->notes(dbd_driver
=> $driver);
441 $build->notes(test_db
=> $test_db);
442 $build->notes(test_host
=> $test_host);
443 $build->notes(test_user
=> $test_user eq 'undef' ?
undef : $test_user);
444 $build->notes(test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass);
445 $build->notes(test_dsn
=> $test_dsn);
447 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
448 " Database $test_db\n",
449 " Host $test_host\n",
451 " User $test_user\n",
452 " Password $test_pass\n");
453 $build->log_info(" - will not run the BioDBSeqFeature live ".
454 "database tests (requires MySQL or Pg driver)\n") unless ($driver eq 'mysql' or $driver eq 'Pg');
457 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
460 $build->log_info("\n");