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 #############################
49 'Access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace'],
51 'Algorithm::Munkres' => [0,
52 'Phylogenetic Networks/Bio::PhyloNetwork'],
54 'Array::Compare' => [0,
55 'Phylogenetic Networks/Bio::PhyloNetwork'],
58 'GenBank->GFF3/bp_genbank2gff3.pl'],
60 # this won't actually install due to circular dep, but we have no way of
61 # doing a post-install the [circular dependency!] specifies it is only
62 # installed on explicit request for this specific module, not when simply
63 # choosing to install 'all' modules
65 #'Bio::ASN1::EntrezGene' => [0,
66 # 'Parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]'],
69 'Cloning objects/Bio::Tools::Primer3'],
71 'Convert::Binary::C' => [0,
72 'Strider functionality/Bio::SeqIO::strider'],
75 'OO-based exception handling (very optional)/Bio::Root::Exception'],
78 'Alignment graphic output/Bio::Align::Graphics'],
81 'Phylogenetic Networks, ontology engine implementation, contig analysis'.
82 '/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,'.
83 'Bio::Assembly::Tools::ContigSpectrum'],
86 'Phylogenetic Network Visulization/Bio::PhyloNetwork::GraphViz'],
88 'HTML::Entities' => [0,
89 'Remote analysis POST submissions/Bio::SearchIO::blastxml'],
91 'HTML::HeadParser' => [3,
92 'Parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder'],
94 'HTTP::Request::Common' => [0,
95 'GenBank+GenPept sequence retrieval, remote http Blast jobs'.
96 '/Bio::DB::*,Bio::Tools::Run::RemoteBlast,'.
97 'Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*'],
99 'List::MoreUtils' => [0,
100 'Back- or reverse-translation of sequences/'.
101 'Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate'],
103 'LWP::UserAgent' => [0,
104 'Remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent'],
106 'Math::Random' => [0,
107 'Random Phylogenetic Networks/Bio::PhyloNetwork::RandomFactory'],
109 'PostScript::TextBlock' => [0,
110 'EPS output/Bio::Tree::Draw::Cladogram'],
113 'Proper operation/Bio::Tree::Compatible'],
116 'Bibliographic queries/Bio::DB::Biblio::soap'],
118 'Sort::Naturally' => [0,
119 'Sort lexically, but sort numeral parts numerically/'.
120 'Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr'],
122 'Spreadsheet::ParseExcel' => [0,
123 'Parsing Excel files/Bio::SeqIO::excel'],
126 'Storing sequence objects in local file cache/'.
127 'Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,'.
128 'Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb'],
131 'Creating SVG images/Bio::Draw::Pictogram'],
133 'SVG::Graph' => [0.01,
134 'Creating SVG images/Bio::TreeIO::svggraph'],
136 'Text::ParseWords' => [0,
137 'Test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader'],
140 'Dealing with web resources/Bio::FeatureIO::gff,Bio::FeatureIO::interpro,'.
141 'Bio::DB::Biblio::eutils,Bio::DB::EUtilParameters,'.
142 'Bio::DB::Query::GenBank,Bio::DB::NCBIHelper,Bio::SeqFeature::Annotated'],
144 'XML::DOM::XPath' => [0.13,
145 'parsing interpro features/Bio::FeatureIO::interpro'],
148 'parsing xml/Bio::Biblio::IO::medlinexml'],
150 'XML::Parser::PerlSAX' => [0,
151 'Parsing XML/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,',
152 'Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp'],
155 'Parsing XML/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax'],
157 'XML::SAX::Writer' => [0,
158 'Writing XML/Bio::SeqIO::tigrxml'],
161 'Reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery'],
164 'Parsing XML/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,'.
165 'Bio::DB::Biblio::eutils'],
167 'XML::Writer' => [0.4,
168 'Parsing and writing XML/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,'.
169 'Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,'.
170 'Bio::SearchIO::Writer::BSMLResultWriter'],
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)]},
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,
202 recommends
=> { # does what you would expect of recommends, except more informative output and generates optional_features in META.yml
203 map {$_ => $recommends{$_}[0]} sort keys %recommends
208 network
=> { } # say 'perl Build.PL --network' to manually request network tests
213 description
=> "Presence of Bio::ASN1::EntrezGene",
214 requires
=> { 'Bio::ASN1::EntrezGene' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
218 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
219 requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
222 'Bio::DB::GFF Tests' => {
223 description
=> "Bio::DB::GFF database tests (will need to answer questions before really enabling)",
224 requires
=> { 'DBI' => 0 },
228 description
=> "MySQL-related tests for Bio::DB::SeqFeature::Store",
229 requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
233 description
=> "PostgreSQL-related tests for Bio::DB::SeqFeature::Store",
234 requires
=> { 'DBI' => 0, 'DBD::Pg' => 0},
238 description
=> "SQLite-related tests for Bio::DB::SeqFeature::Store",
239 requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0},
243 description
=> "Enable tests that need an internet connection",
244 requires
=> { 'LWP::UserAgent' => 0 },
248 create_makefile_pl
=> 'passthrough',
249 recursive_test_files
=> 1,
251 # Extra files needed for BioPerl modules
252 xml_files
=> {'./Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'},
254 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
255 #script_files => [] # scripts in scripts directory are installed on-demand
258 my $accept = $build->args('accept');
260 # how much do I hate this? Let me count the ways.....
261 if (!$build->feature('EntrezGene')) {
263 ############################# WARNING #############################
265 Bio::ASN1::EntrezGene not found. This is an *optional* module;
266 however, because it has a circular dependency with BioPerl we do not
267 include it on our list of recommended modules.
269 If you require EntrezGene functionality, you can install
270 Bio::ASN1::EntrezGene after BioPerl has finished installing.
272 ############################# WARNING #############################
278 my $proceed = prompt_for_biodb
($accept) if $build->feature('Bio::DB::GFF')
279 || $build->feature('MySQL Tests') || $build->feature('MySQL 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(" - will not run network tests since I seem to be missing essential network functionality\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) || die "Can't create test file\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
334 @drivers = DBI
->available_drivers;
335 unless (grep {/mysql|Pg|SQLite/i} @drivers) {
337 return "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
344 my $dsn = $build->notes('test_dsn') || return;
345 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
346 my $driver = $build->notes('dbd_driver');
347 my $path = File
::Spec
->catfile('t', 'LocalDB',
348 ($driver eq 'mysql') ?
'SeqFeature_mysql.t' :
349 ($driver eq 'SQLite') ?
'SeqFeature_SQLite.t' :
351 my $test_db = $build->notes('test_db');
352 my $user = $build->notes('test_user');
353 my $pass = $build->notes('test_pass');
355 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn \"$dsn\"";
356 $str .= " -user $user" if $user;
357 $str .= " -password $pass" if $pass;
362 $build->add_to_cleanup($path);
363 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
364 #$build->add_to_manifest_skip($path);
368 eval {require DBI
;}; # if not installed, this sub won't actually be called
369 @drivers = DBI
->available_drivers;
370 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
371 return "MySQL, Pg nor Oracle DBI drivers are installed";
376 sub prompt_for_biodb
{
378 my $proceed = $accept ?
0 : $build->y_n("Do you want to run the Bio::DB::GFF or ".
379 "Bio::DB::SeqFeature::Store live database tests? ".
384 foreach my $poss ('SQLite', 'mysql', 'Pg', 'Oracle') {
385 if (grep {/$poss/i} @drivers) {
387 $choice =~ s/^(.)/[$1]/;
388 push(@driver_choices, $choice);
393 if (@driver_choices > 1) {
394 my ($default) = $driver_choices[0] =~ /\[(.)/;
395 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
398 ($driver) = $driver_choices[0] =~ /\[(.)/;
400 if ($driver =~ /^[mM]/) {
403 elsif ($driver =~ /^[pP]/) {
406 elsif ($driver =~ /^[oO]/) {
409 elsif ($driver =~ /^[sS]/) {
413 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?\n".
414 "This database should already be present but doesn't have to ".
415 "be preloaded for any schema", 'test');
416 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
417 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
418 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
421 if ($test_host eq 'undef' || $test_host eq 'localhost') {
426 if ($driver eq 'Pg' || $driver eq 'SQLite') {
427 $test_dsn = "dbi:$driver:dbname=$test_db";
431 $test_dsn = "dbi:$driver:database=$test_db";
435 $test_dsn .= ";host=$test_host";
438 $build->notes(dbd_driver
=> $driver);
439 $build->notes(test_db
=> $test_db);
440 $build->notes(test_host
=> $test_host);
441 $build->notes(test_user
=> $test_user eq 'undef' ?
undef : $test_user);
442 $build->notes(test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass);
443 $build->notes(test_dsn
=> $test_dsn);
445 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
446 " Database $test_db\n",
447 " Host $test_host\n",
449 " User $test_user\n",
450 " Password $test_pass\n");
451 $build->log_info(" - will not run the BioDBSeqFeature live ".
452 "database tests (requires MySQL or Pg driver)\n") unless ($driver eq 'mysql' or $driver eq 'Pg');
455 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
458 $build->log_info("\n");