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 'Cloning objects/Bio::Root::Root,Bio::Tools::Primer3'],
70 'Convert::Binary::C' => [0,
71 'Strider functionality/Bio::SeqIO::strider'],
74 'OO-based exception handling (very optional)/Bio::Root::Exception'],
77 'Alignment graphic output/Bio::Align::Graphics'],
80 'Phylogenetic Networks, ontology engine implementation, contig analysis'.
81 '/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,'.
82 'Bio::Assembly::Tools::ContigSpectrum'],
85 'Phylogenetic Network Visulization/Bio::PhyloNetwork::GraphViz'],
87 'HTML::Entities' => [0,
88 'Remote analysis POST submissions/Bio::SearchIO::blastxml'],
90 'HTML::HeadParser' => [3,
91 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'],
93 'HTML::TableExtract' => [0,
94 'Parsing HTML tables/Bio::DB::SeqVersion::gi'],
96 'HTTP::Request::Common' => [0,
97 'GenBank+GenPept sequence retrieval, remote http Blast jobs'.
98 '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'.
99 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'],
101 'List::MoreUtils' => [0,
102 'Back- or reverse-translation of sequences/'.
103 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'],
105 'LWP::UserAgent' => [0,
106 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'],
108 'Math::Random' => [0,
109 'Random Phylogenetic Networks/Bio::PhyloNetwork::RandomFactory'],
111 'PostScript::TextBlock' => [0,
112 'EPS output/Bio::Tree::Draw::Cladogram'],
115 'Proper operation/Bio::Tree::Compatible'],
118 'Bibliographic queries/Bio::DB::Biblio::soap'],
120 'Sort::Naturally' => [0,
121 'Sort lexically, but sort numeral parts numerically/'.
122 'Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr'],
124 'Spreadsheet::ParseExcel' => [0,
125 'Parsing Excel files/Bio::SeqIO::excel'],
128 'Storing sequence objects in local file cache/'.
129 'Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,'.
130 'Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb,Bio::Root::Root'],
133 'Creating SVG images/Bio::Draw::Pictogram'],
135 'SVG::Graph' => [0.01,
136 'Creating SVG images/Bio::TreeIO::svggraph'],
138 'Text::ParseWords' => [0,
139 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader'],
141 'XML::DOM::XPath' => [0.13,
142 'parsing interpro features/Bio::FeatureIO::interpro'],
145 'parsing xml/Bio::Biblio::IO::medlinexml'],
147 'XML::Parser::PerlSAX' => [0,
148 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
149 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'],
152 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'],
154 'XML::SAX::Writer' => [0,
155 'Writing XML/Bio::SeqIO::tigrxml'],
158 'Reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery'],
161 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,'.
162 'Bio::DB::Biblio::eutils'],
164 'XML::Writer' => [0.4,
165 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'.
166 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'.
167 'Bio::SearchIO::Writer::BSMLResultWriter'],
170 'GenBank->GFF3/bp_genbank2gff3.pl'],
175 my @drivers = available_drivers
();
177 # Set up the Bio::Root::Build object
178 my $build = Bio
::Root
::Build
->new(
179 module_name
=> 'Bio',
180 dist_name
=> 'BioPerl',
181 dist_version_from
=> 'Bio/Root/Version.pm',
182 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
183 dist_abstract
=> 'Bioinformatics Toolkit',
185 no_index
=> {'dir' => [qw(examples/root/lib)]},
188 'IO::String' => 0, # why is this required?
189 'DB_File' => 0, # why is this required?
190 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
191 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
192 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
197 'Module::Build' => 0.2805,
198 'Test::Harness' => 2.62,
204 # reverted to a simple Module::Build-compatible hash, but we keep
205 # additional data in the %recommends hash above. May be converted to
206 # something simpler if there aren't complaints down the line.
207 map {$_ => $recommends{$_}[0]} sort keys %recommends
212 network
=> { } # say 'perl Build.PL --network' to manually request network tests
217 description
=> "Presence of Bio::ASN1::EntrezGene",
218 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
222 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
223 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
226 'Bio::DB::GFF Tests' => {
227 description
=> "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
228 requires
=> { 'DBI' => 0 },
232 description
=> "MySQL-related tests for Bio::DB::SeqFeature::Store",
233 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
237 description
=> "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
238 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0},
242 description
=> "SQLite-related tests for Bio::DB::SeqFeature::Store",
243 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0},
247 description
=> "Enable tests that need an internet connection",
248 requires
=> { 'LWP::UserAgent' => 0 },
252 #create_makefile_pl => 'passthrough',
253 recursive_test_files
=> 1,
255 # Extra files needed for BioPerl modules
256 xml_files
=> {'./Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'},
258 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
259 #script_files => [] # scripts in scripts directory are installed on-demand
262 my $accept = $build->args('accept');
264 # how much do I hate this? Let me count the ways.....
265 if (!$build->feature('EntrezGene')) {
267 ############################# WARNING #############################
269 Bio::ASN1::EntrezGene not found. This is an *optional* module;
270 however, because it has a circular dependency with BioPerl we do not
271 include it on our list of recommended modules.
273 If you require EntrezGene functionality, you can install
274 Bio::ASN1::EntrezGene after BioPerl has finished installing.
276 ############################# WARNING #############################
282 my $proceed = prompt_for_biodb
($accept)
283 if $build->feature('Bio::DB::GFF') || $build->feature('MySQL Tests') ||
284 $build->feature('Pg Tests') || $build->feature('SQLite Tests');
286 # Handle auto features
287 if ($proceed && $build->feature('DB_File Tests')) {
288 # will return without doing anything if user chose not to run tests during
291 if ($proceed && ($build->feature('MySQL Tests') ||
292 $build->feature('Pg Tests') ||
293 $build->feature('SQLite Tests'))) {
298 $build->choose_scripts($accept);
300 if ($build->args('network')) {
301 if ($build->feature('Network Tests')) {
302 $build->notes(network
=> 1);
303 $build->log_info(" - will run internet-requiring tests\n");
306 $build->notes(network
=> 0);
307 $build->log_info(" - Missing LWP::UserAgent, can't run network tests\n");
311 $build->prompt_for_network($accept) if $build->feature('Network Tests');
314 # Add additional files here
315 $build->add_build_element('xml');
317 # Create the build script and exit
318 $build->create_build_script;
322 ########################## Helper subs ##########################
325 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
326 my $path = File
::Spec
->catfile('t', 'LocalDB','SeqFeature_BDB.t');
327 unlink($path) if (-e
$path);
328 open(my $F, ">", $path) || die "Can't create test file\n";
330 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
333 $build->add_to_cleanup($path);
334 #$build->add_to_manifest_skip($path);
337 sub available_drivers
{
338 eval {require DBI
; 1;}; # if not installed, this sub won't actually be called
340 @drivers = DBI
->available_drivers;
341 unless (grep {/mysql|Pg|SQLite/i} @drivers) {
343 return "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
350 my $dsn = $build->notes('test_dsn') || return;
351 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
352 my $driver = $build->notes('dbd_driver');
353 my $path = File
::Spec
->catfile('t', 'LocalDB',
354 ($driver eq 'mysql') ?
'SeqFeature_mysql.t' :
355 ($driver eq 'SQLite') ?
'SeqFeature_SQLite.t' :
357 my $test_db = $build->notes('test_db');
358 my $user = $build->notes('test_user');
359 my $pass = $build->notes('test_pass');
361 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
362 $str .= " -user $user" if $user;
363 $str .= " -password $pass" if $pass;
368 $build->add_to_cleanup($path);
369 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
370 #$build->add_to_manifest_skip($path);
374 eval {require DBI
;}; # if not installed, this sub won't actually be called
376 @drivers = DBI
->available_drivers;
377 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
378 return "MySQL, Pg nor Oracle DBI drivers are installed";
383 sub prompt_for_biodb
{
385 my $proceed = $accept ?
0 : $build->y_n("Do you want to run the Bio::DB::GFF or ".
386 "Bio::DB::SeqFeature::Store live database tests? ".
391 foreach my $poss ('SQLite', 'mysql', 'Pg', 'Oracle') {
392 if (grep {/$poss/i} @drivers) {
394 $choice =~ s/^(.)/[$1]/;
395 push(@driver_choices, $choice);
400 if (@driver_choices > 1) {
401 my ($default) = $driver_choices[0] =~ /\[(.)/;
402 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
405 ($driver) = $driver_choices[0] =~ /\[(.)/;
407 if ($driver =~ /^[mM]/) {
410 elsif ($driver =~ /^[pP]/) {
413 elsif ($driver =~ /^[oO]/) {
416 elsif ($driver =~ /^[sS]/) {
420 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?\n".
421 "This database should already be present but doesn't have to ".
422 "be preloaded for any schema", 'test');
423 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
424 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
425 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
428 if ($test_host eq 'undef' || $test_host eq 'localhost') {
433 if ($driver eq 'Pg' || $driver eq 'SQLite') {
434 $test_dsn = "dbi:$driver:dbname=$test_db";
438 $test_dsn = "dbi:$driver:database=$test_db";
442 $test_dsn .= ";host=$test_host";
445 $build->notes(dbd_driver
=> $driver);
446 $build->notes(test_db
=> $test_db);
447 $build->notes(test_host
=> $test_host);
448 $build->notes(test_user
=> $test_user eq 'undef' ?
undef : $test_user);
449 $build->notes(test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass);
450 $build->notes(test_dsn
=> $test_dsn);
452 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
453 " Database $test_db\n",
454 " Host $test_host\n",
456 " User $test_user\n",
457 " Password $test_pass\n");
458 $build->log_info(" - will not run the BioDBSeqFeature live ".
459 "database tests (requires MySQL or Pg driver)\n") unless ($driver eq 'mysql' or $driver eq 'Pg');
462 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
465 $build->log_info("\n");