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 ModuleBuildBioperl that
7 # doesn't get installed
9 # In the future developers may need to alter the requires and recommends and
10 # possibly Network sections of ModuleBuildBioperl->new() below, but otherwise
11 # nothing else here is likely to need changing.
14 use ModuleBuildBioperl
;
20 # Set up the ModuleBuildBioperl object
21 my $build = ModuleBuildBioperl
->new(
23 dist_name
=> 'bioperl',
24 dist_version_from
=> 'Bio/Root/Version.pm',
25 dist_author
=> 'Bioperl Team <bioperl-l@bioperl.org>',
26 dist_abstract
=> 'Bioinformatics Toolkit',
32 'Data::Stag' => 0.10, # Bio::SeqIO::swiss, we can change to 'recommend' if needed
33 'Scalar::Util' => 0 # not in Perl 5.6.1, arrived in core in 5.7.3
37 'Module::Build' => 0.2805,
38 'Test::Harness' => 2.62,
41 recommends
=> { # does what you would expect of recommends, except more informative output and generates optional_features in META.yml
42 'Ace' => '0/access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace',
43 # this won't actually install due to circular dep, but we have no way of doing a post-install
44 # the [circular dependency!] specifies it is only installed on explicit request for this specific module,
45 # not when simply choosing to install 'all' modules
46 'Bio::ASN1::EntrezGene' => '0/parsing entrezgene/Bio::SeqIO::entrezgene [circular dependency!]',
47 # we actually need 1.01 of Class::AutoClass, but unfortunately it is versioned as 1.0
48 'Class::AutoClass' => '1/creating objects/Bio::Graph::SimpleGraph,Bio::Graph::SimpleGraph::Traversal,Bio::Graph::ProteinGraph',
49 'Clone' => '0/cloning objects/Bio::Graph::ProteinGraph,Bio::Tools::Primer3',
50 'Convert::Binary::C' => '0/strider functionality/Bio::SeqIO::strider',
51 # part of Data::Stag, which is now required above (note the default use of Data::Stag in BioPerl does not require XML::Parser::PerlSAX)
52 #'Data::Stag::XMLWriter' => '0/writing choas xml files/Bio::SeqIO::chaosxml',
53 'GD' => '1.3/rendering Sequences and Features/Bio::Graphics::Glyph*',
54 'GD::SVG' => '0/creating SVG images/Bio::Graphics::Panel',
55 # we specifically want Graph::Directed, but that has no VERSION
56 'Graph' => '0/ontology engine implementation for the GO parser/Bio::Ontology::SimpleGOEngine::GraphAdaptor,Bio::PhyloNetwork',
57 'HTML::Entities' => '0/remote analysis POST submissions/Bio::SearchIO::blastxml',
58 'HTML::Parser' => '3/screen scraping www.gdb.org/Bio::DB::GDB',
59 '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*',
60 'LWP::UserAgent' => '0/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::WebBlat,Bio::WebAgent,Bio::Graphics::Glyph::image',
61 'PostScript::TextBlock' => '0/EPS output/Bio::Tree::Draw::Cladogram',
62 'Set::Scalar' => '0/proper operation/Bio::Tree::Compatible',
63 'SOAP::Lite' => '0/XEMBL Services and Bibliographic queries/Bio::DB::XEMBLService,Bio::DB::Biblio::soap',
64 'Spreadsheet::ParseExcel' => '0/parsing Excel files/Bio::SeqIO::excel',
65 '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',
66 'SVG' => '2.26/SVG output/Bio::Graphics::Pictogram',
67 'SVG::Graph' => '0.01/creating SVG images/Bio::TreeIO::svggraph',
68 'Text::ParseWords' => '0/test scripts/Bio::Graphics',
69 'URI::Escape' => '0/dealing with web resources/Bio::Tools::WebBlat,Bio::FeatureIO::gff,Bio::FeatureIO::interpro,Bio::DB::Biblio::eutils,Bio::DB::EUtilities::Cookie,Bio::DB::Query::GenBank,Bio::DB::NCBIHelper,Bio::SeqFeature::Annotated',
70 'XML::DOM::XPath' => '0.13/parsing interpro features/Bio::FeatureIO::interpro',
71 'XML::Parser' => '0/parsing xml/Bio::Biblio::IO::medlinexml',
72 'XML::Parser::PerlSAX' => '0/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
73 'XML::SAX' => '0.15/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
74 'XML::SAX::Writer' => '0/writing xml/Bio::SeqIO::tigrxml',
75 'XML::Twig' => '0/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils,Bio::Graph::IO::psi_xml',
76 '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',
77 'Math::Random' => '0/Random Phylogenetic Networks/Bio::PhyloNetwork::RandomFactory',
78 'Algorithm::Munkres' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
79 'Array::Compare' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
80 'GraphViz' => '0/Phylogenetic Network Visulization/Bio::PhyloNetwork::GraphViz',
83 network
=> { } # say 'perl Build.PL --network' to manually request network tests
86 BioDBSeqFeature_BDB
=> {
87 description
=> "BDB tests for Bio::DB::SeqFeature::Store",
88 feature_requires
=> { 'DB_File' => 0 } # feature_requires is like requires, execpt that it doesn't trigger installation
91 description
=> "BioDBGFF database tests (will need to answer questions before really enabling)",
92 feature_requires
=> { 'DBI' => 0 },
93 excludes_os
=> ['mswin'],
94 test
=> \
&test_biodbgff
# ModuleBuildBioperl unique requirement that after everything else succeeds, supplied code ref must also return undef
96 BioDBSeqFeature_mysql
=> {
97 description
=> "MySQL tests for Bio::DB::SeqFeature::Store",
98 feature_requires
=> { 'DBI' => 0, 'DBD::mysql' => 0 },
102 description
=> "Enable tests that need an internet connection",
103 requires
=> { 'LWP::UserAgent' => 0 },
104 test
=> \
&ModuleBuildBioperl
::test_internet
108 create_makefile_pl
=> 'passthrough'
110 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
111 #script_files => [] # scripts in scripts directory are installed on-demand
114 my $accept = $build->args->{accept};
116 prompt_for_biodb
($accept) if $build->feature('BioDBGFF') || $build->feature('BioDBSeqFeature_mysql');
118 # Handle auto features
119 if ($build->feature('BioDBSeqFeature_BDB') && $mysql_ok) {
120 # will return without doing anything if user chose not to run tests during
121 # prompt_for_biodb() above
124 if ($build->feature('BioDBSeqFeature_mysql')) {
129 $build->choose_scripts($accept);
130 #prompt_for_biodbgff($accept) if $build->feature('BioDBGFF');
132 if ($build->args('network')) {
133 if ($build->feature('Network')) {
134 $build->notes(network
=> 1);
135 $build->log_info(" - will run internet-requiring tests\n");
138 $build->notes(network
=> 0);
139 $build->log_info(" - will not run network tests since I seem to be missing essential network functionality\n");
143 prompt_for_network
($accept) if $build->feature('Network');
145 # then in test script:
147 # my $build = Module::Build->current;
148 # my $do_network_tests = $build->notes('network');
151 # Request that some scripts run post-installation
152 $build->add_post_install_script('maintenance/symlink_script.pl'); # takes a unix file path regardless of local OS
154 # Add extra things to MANIFEST.SKIP
155 $build->add_to_manifest_skip('bioperl.lisp', 'Bio/Tools/WebBlat.pm');
157 # Create the build script and exit
158 $build->create_build_script;
164 my $path0 = File
::Spec
->catfile('t', 'BioDBSeqFeature.t');
165 my $path = File
::Spec
->catfile('t', 'BioDBSeqFeature_BDB.t');
166 unlink($path) if (-e
$path);
167 open(my $F, ">", $path) || die "Can't create test file\n";
169 system 'perl $path0 -adaptor berkeleydb -create 1 -temp 1';
172 $build->add_to_cleanup($path);
173 $build->add_to_manifest_skip($path);
177 eval {require DBI
;}; # if not installed, this sub won't actually be called
178 @drivers = DBI
->available_drivers;
179 unless (grep {/mysql/i} @drivers) {
181 return "Only MySQL DBI driver supported for BioDBSeqFeature_mysql tests";
188 my $dsn = $build->notes('test_dsn') || return;
189 my $path0 = File
::Spec
->catfile('t', 'BioDBSeqFeature.t');
190 my $path = File
::Spec
->catfile('t', 'BioDBSeqFeature_mysql.t');
191 my $test_db = $build->notes('test_db');
192 my $user = $build->notes('test_user');
193 my $pass = $build->notes('test_pass');
195 my $str = "$path0 -adaptor DBI::mysql -create 1 -temp 1 -dsn $dsn";
196 $str .= " -user $user" if $user;
197 $str .= " -password $pass" if $pass;
202 $build->add_to_cleanup($path);
203 $build->add_to_manifest_skip($path);
207 eval {require DBI
;}; # if not installed, this sub won't actually be called
208 @drivers = DBI
->available_drivers;
209 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
210 return "MySQL, Pg nor Oracle DBI drivers are installed";
215 sub prompt_for_biodb
{
217 my $proceed = $accept ?
0 : $build->y_n("Do you want to run the BioDBGFF or ".
218 "BioDBSeqFeature_mysql live database tests? ".
223 foreach my $poss ('mysql', 'Pg', 'Oracle') {
224 if (grep {/$poss/i} @drivers) {
226 $choice =~ s/^(.)/[$1]/;
227 push(@driver_choices, $choice);
232 if (@driver_choices > 1) {
233 my ($default) = $driver_choices[0] =~ /\[(.)/;
234 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
237 ($driver) = $driver_choices[0] =~ /\[(.)/;
239 if ($driver =~ /^[mM]/) {
242 elsif ($driver =~ /^[pP]/) {
245 elsif ($driver =~ /^[oO]/) {
249 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?", 'test');
250 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
251 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
252 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
255 if ($test_host eq 'undef' || $test_host eq 'localhost') {
260 if ($driver eq 'Pg') {
261 $test_dsn = "dbi:$driver:dbname=$test_db";
265 $test_dsn = "dbi:$driver:database=$test_db";
269 $test_dsn .= ";host=$test_host";
272 $build->notes(dbd_driver
=> $driver);
273 $build->notes(test_db
=> $test_db);
274 $build->notes(test_host
=> $test_host);
275 $build->notes(test_user
=> $test_user eq 'undef' ?
undef : $test_user);
276 $build->notes(test_pass
=> $test_pass eq 'undef' ?
undef : $test_pass);
277 $build->notes(test_dsn
=> $test_dsn);
279 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
280 " Database $test_db\n",
281 " Host $test_host\n",
283 " User $test_user\n",
284 " Password $test_pass\n");
285 $build->log_info(" - will not run the BioDBSeqFeature_mysql live ".
286 "database tests (requires MySQL driver)\n") unless $mysql_ok;
289 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
292 $build->log_info("\n");
295 sub prompt_for_network
{
298 my $proceed = $accept
299 ?
0 :$build->y_n("Do you want to run tests that require connection to servers across the internet\n(likely to cause some failures)? y/n", 'n');
302 $build->notes(network
=> 1);
303 $build->log_info(" - will run internet-requiring tests\n");
306 $build->notes(network
=> 0);
307 $build->log_info(" - will not run internet-requiring tests\n");