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 # http://bugzilla.open-bio.org/show_bug.cgi?id=2975
32 if (grep {$_->{Name
} =~ 'XML::SAX::RTF'} @
{XML
::SAX
->parsers()}) {
34 ############################# WARNING #############################
36 XML::SAX::RTF is not XML::SAX-compliant but is registered as an
37 XML::SAX parser. If used as the primary parser, modules requiring
38 XML::SAX will NOT work. Please install another XML::SAX-compliant
39 module and modify your local ParserDetails.ini file per XML::SAX docs
40 to remove references to XML::SAX::RTF.
42 ############################# WARNING #############################
54 # Set up the Bio::Root::Build object
55 my $build = Bio
::Root
::Build
->new(
57 dist_name
=> 'BioPerl',
58 dist_version_from
=> 'Bio/Root/Version.pm',
59 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
60 dist_abstract
=> 'Bioinformatics Toolkit',
62 no_index
=> {'dir' => [qw(examples/root/lib)]},
67 'Data::Stag' => 0.11, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
68 'Scalar::Util' => 0, # not in Perl 5.6.1, arrived in core in 5.7.3
69 'ExtUtils::Manifest' => '1.52', # allows spaces in file names
73 'Module::Build' => 0.2805,
74 'Test::Harness' => 2.62,
77 recommends
=> { # does what you would expect of recommends, except more informative output and generates optional_features in META.yml
78 'Ace' => '0/access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace',
79 'Algorithm::Munkres' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
80 'Array::Compare' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
81 # this won't actually install due to circular dep, but we have no way of doing a post-install
82 # the [circular dependency!] specifies it is only installed on explicit request for this specific module,
83 # not when simply choosing to install 'all' modules
84 'Bio::ASN1::EntrezGene' => '0/parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]',
85 'Clone' => '0/cloning objects/Bio::Tools::Primer3',
86 'Convert::Binary::C' => '0/strider functionality/Bio::SeqIO::strider',
87 'Graph' => '0/Phylogenetic Networks, ontology engine implementation, contig analysis/Bio::PhyloNetwork,Bio::Ontology::SimpleGOEngine::GraphAdaptor,Bio::Assembly::Tools::ContigSpectrum',
88 'GraphViz' => '0/Phylogenetic Network Visulization/Bio::PhyloNetwork::GraphViz',
89 'HTML::Entities' => '0/remote analysis POST submissions/Bio::SearchIO::blastxml',
90 'HTML::HeadParser' => '3/parsing <HEAD> section of HTML docs/Bio::Tools::Analysis::DNA::ESEfinder',
91 'HTTP::Request::Common' => '0/GenBank+GenPept sequence retrieval, remote http Blast jobs/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*',
92 'List::MoreUtils' => '0/Back- or reverse-translation of sequences/Bio::Tools::SeqPattern,Bio::Tools::SeqPattern::BackTranslate',
93 'LWP::UserAgent' => '0/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent',
94 'Math::Random' => '0/Random Phylogenetic Networks/Bio::PhyloNetwork::RandomFactory',
95 'PostScript::TextBlock' => '0/EPS output/Bio::Tree::Draw::Cladogram',
96 'Set::Scalar' => '0/proper operation/Bio::Tree::Compatible',
97 'SOAP::Lite' => '0/Bibliographic queries/Bio::DB::Biblio::soap',
98 'Sort::Naturally' => '0/sort lexically, but sort numeral parts numerically/Bio::Assembly::IO::ace,Bio::Assembly::IO::tigr',
99 'Spreadsheet::ParseExcel' => '0/parsing Excel files/Bio::SeqIO::excel',
100 'Storable' => '2.05/storing sequence objects in local file cache/Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb',
101 'SVG' => '2.26/creating SVG images/Bio::Draw::Pictogram',
102 'SVG::Graph' => '0.01/creating SVG images/Bio::TreeIO::svggraph',
103 'Text::ParseWords' => '0/test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader',
104 'URI::Escape' => '0/dealing with web resources/Bio::FeatureIO::gff,Bio::FeatureIO::interpro,Bio::DB::Biblio::eutils,Bio::DB::EUtilParameters,Bio::DB::Query::GenBank,Bio::DB::NCBIHelper,Bio::SeqFeature::Annotated',
105 'XML::DOM::XPath' => '0.13/parsing interpro features/Bio::FeatureIO::interpro',
106 'XML::Parser' => '0/parsing xml/Bio::Biblio::IO::medlinexml',
107 'XML::Parser::PerlSAX' => '0/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
108 'XML::SAX' => '0.15/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
109 'XML::SAX::Writer' => '0/writing xml/Bio::SeqIO::tigrxml',
110 'XML::Simple' => '0/reading custom XML/Bio::Tools::EUtilities,Bio::DB::HIV,Bio::DB::Query::HIVQuery',
111 'XML::Twig' => '0/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils',
112 'XML::Writer' => '0.4/parsing and writing xml/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,Bio::SearchIO::Writer::BSMLResultWriter',
116 network
=> { } # say 'perl Build.PL --network' to manually request network tests
119 BioDBSeqFeature_BDB
=> {
120 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
121 feature_requires
=> { 'DB_File' => 0 } # feature_requires is like requires, except that it doesn't trigger installation
124 description
=> "BioDBGFF database tests (will need to answer questions before really enabling)",
125 feature_requires
=> { 'DBI' => 0 },
126 excludes_os
=> ['mswin'],
127 test
=> \
&test_biodbgff
# Bio::Root::Build unique requirement that after everything else succeeds, supplied code ref must also return undef
129 BioDBSeqFeature_mysql
=> {
130 description
=> "MySQL tests for Bio::DB::SeqFeature::Store",
131 feature_requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
134 BioDBSeqFeature_Pg
=> {
135 description
=> "Postgres tests for Bio::DB::SeqFeature::Store",
136 feature_requires
=> { 'DBI' => 0, 'DBD::Pg' => 0},
139 BioDBSeqFeature_SQLite
=> {
140 description
=> "SQLite tests for Bio::DB::SeqFeature::Store",
141 feature_requires
=> { 'DBI' => 0, 'DBD::SQLite' => 0},
145 description
=> "Enable tests that need an internet connection",
146 feature_requires
=> { 'LWP::UserAgent' => 0 },
147 test
=> \
&Bio
::Root
::Build
::test_internet
151 create_makefile_pl
=> 'passthrough',
152 recursive_test_files
=> 1,
153 # Extra files needed for BioPerl modules
154 xml_files
=> {'./Bio/DB/HIV/lanl-schema.xml' => 'lib/Bio/DB/HIV/lanl-schema.xml'},
156 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
157 #script_files => [] # scripts in scripts directory are installed on-demand
160 my $accept = $build->args->{accept};
162 my $proceed = prompt_for_biodb
($accept) if $build->feature('BioDBGFF') || $build->feature('BioDBSeqFeature_mysql');
164 # Handle auto features
165 if ($proceed && $build->feature('BioDBSeqFeature_BDB')) {
166 # will return without doing anything if user chose not to run tests during
167 # prompt_for_biodb() above
170 if ($proceed && ($build->feature('BioDBSeqFeature_mysql') or $build->feature('BioDBSeqFeature_Pg'))) {
175 $build->choose_scripts($accept);
176 #prompt_for_biodbgff($accept) if $build->feature('BioDBGFF');
178 if ($build->args('network')) {
179 if ($build->feature('Network')) {
180 $build->notes(network
=> 1);
181 $build->log_info(" - will run internet-requiring tests\n");
184 $build->notes(network
=> 0);
185 $build->log_info(" - will not run network tests since I seem to be missing essential network functionality\n");
189 $build->prompt_for_network($accept) if $build->feature('Network');
191 # then in test script:
192 # use Bio::Root::Build;
193 # my $build = Module::Build->current;
194 # my $do_network_tests = $build->notes('network');
197 # Request that some scripts run post-installation
198 $build->add_post_install_script('maintenance/symlink_script.pl'); # takes a unix file path regardless of local OS
200 # Add extra things to MANIFEST.SKIP
201 $build->add_to_manifest_skip('bioperl.lisp');
203 # Add additional files here
204 $build->add_build_element('xml');
206 # Create the build script and exit
207 $build->create_build_script;
212 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
213 my $path = File
::Spec
->catfile('t', 'LocalDB','SeqFeature_BDB.t');
214 unlink($path) if (-e
$path);
215 open(my $F, ">", $path) || die "Can't create test file\n";
217 system '$^X $path0 -adaptor berkeleydb -create 1 -temp 1';
220 $build->add_to_cleanup($path);
221 $build->add_to_manifest_skip($path);
225 eval {require DBI
;}; # if not installed, this sub won't actually be called
226 @drivers = DBI
->available_drivers;
227 unless (grep {/mysql|Pg|SQLite/i} @drivers) {
229 return "Only MySQL, Postgres and SQLite DBI drivers supported for Bio::DB::SeqFeature RDMS tests";
236 my $dsn = $build->notes('test_dsn') || return;
237 my $path0 = File
::Spec
->catfile('t', 'LocalDB', 'SeqFeature.t');
238 my $driver = $build->notes('dbd_driver');
239 my $path = File
::Spec
->catfile('t', 'LocalDB',
240 ($driver eq 'mysql') ?
'SeqFeature_mysql.t' :
241 ($driver eq 'SQLite') ?
'SeqFeature_SQLite.t' :
243 my $test_db = $build->notes('test_db');
244 my $user = $build->notes('test_user');
245 my $pass = $build->notes('test_pass');
247 my $str = "$path0 -adaptor DBI::$driver -create 1 -temp 1 -dsn $dsn";
248 $str .= " -user $user" if $user;
249 $str .= " -password $pass" if $pass;
254 $build->add_to_cleanup($path);
255 $build->add_to_cleanup($test_db) if $driver eq 'SQLite';
256 $build->add_to_manifest_skip($path);
260 eval {require DBI
;}; # if not installed, this sub won't actually be called
261 @drivers = DBI
->available_drivers;
262 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
263 return "MySQL, Pg nor Oracle DBI drivers are installed";
268 sub prompt_for_biodb
{
270 my $proceed = $accept ?
0 : $build->y_n("Do you want to run the Bio::DB::GFF or ".
271 "Bio::DB::SeqFeature::Store live database tests? ".
276 foreach my $poss ('SQLite', 'mysql', 'Pg', 'Oracle') {
277 if (grep {/$poss/i} @drivers) {
279 $choice =~ s/^(.)/[$1]/;
280 push(@driver_choices, $choice);
285 if (@driver_choices > 1) {
286 my ($default) = $driver_choices[0] =~ /\[(.)/;
287 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
290 ($driver) = $driver_choices[0] =~ /\[(.)/;
292 if ($driver =~ /^[mM]/) {
295 elsif ($driver =~ /^[pP]/) {
298 elsif ($driver =~ /^[oO]/) {
301 elsif ($driver =~ /^[sS]/) {
305 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?\n".
306 "This database should already be present but doesn't have to ".
307 "be preloaded for any schema", 'test');
308 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
309 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
310 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
313 if ($test_host eq 'undef' || $test_host eq 'localhost') {
318 if ($driver eq 'Pg' || $driver eq 'SQLite') {
319 $test_dsn = "dbi:$driver:dbname=$test_db";
323 $test_dsn = "dbi:$driver:database=$test_db";
327 $test_dsn .= ";host=$test_host";
330 $build->notes(dbd_driver
=> $driver);
331 $build->notes(test_db
=> $test_db);
332 $build->notes(test_host
=> $test_host);
333 $build->notes(test_user
=> $test_user eq 'undef' ?
undef : $test_user);
334 $build->notes(test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass);
335 $build->notes(test_dsn
=> $test_dsn);
337 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
338 " Database $test_db\n",
339 " Host $test_host\n",
341 " User $test_user\n",
342 " Password $test_pass\n");
343 $build->log_info(" - will not run the BioDBSeqFeature live ".
344 "database tests (requires MySQL or Pg driver)\n") unless ($driver eq 'mysql' or $driver eq 'Pg');
347 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
350 $build->log_info("\n");