Remove dependencies for Bio::Graphics and deprecated modules
[bioperl-live.git] / Build.PL
blob669ecd09caadc3306e8a43e00e998b7c3fd0fa3f
1 #!/usr/bin/perl -w
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.
12 use strict;
13 use lib '.';
14 use Bio::Root::Build;
16 our @drivers;
18 my $mysql_ok = 0;
20 # Set up the Bio::Root::Build object
21 my $build = Bio::Root::Build->new(
22 module_name => 'Bio',
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',
27 license => 'perl',
28 requires => {
29 'perl' => '5.6.1',
30 'IO::String' => 0,
31 'DB_File' => 0,
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
35 build_requires => {
36 'Test::More' => 0,
37 'Module::Build' => 0.2805,
38 'Test::Harness' => 2.62,
39 'CPAN' => 1.81
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 'Clone' => '0/cloning objects/Bio::Tools::Primer3',
49 'Convert::Binary::C' => '0/strider functionality/Bio::SeqIO::strider',
50 # part of Data::Stag, which is now required above (note the default use of Data::Stag in BioPerl does not require XML::Parser::PerlSAX)
51 #'Data::Stag::XMLWriter' => '0/writing choas xml files/Bio::SeqIO::chaosxml',
52 # we specifically want Graph::Directed, but that has no VERSION
53 'Graph' => '0/ontology engine implementation for the GO parser/Bio::PhyloNetwork',
54 'HTML::Entities' => '0/remote analysis POST submissions/Bio::SearchIO::blastxml',
55 'HTML::Parser' => '3/screen scraping www.gdb.org/Bio::DB::GDB',
56 '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*',
57 'LWP::UserAgent' => '0/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::WebAgent,Bio::Graphics::Glyph::image',
58 'PostScript::TextBlock' => '0/EPS output/Bio::Tree::Draw::Cladogram',
59 'Set::Scalar' => '0/proper operation/Bio::Tree::Compatible',
60 'SOAP::Lite' => '0/Bibliographic queries/Bio::DB::Biblio::soap',
61 'Spreadsheet::ParseExcel' => '0/parsing Excel files/Bio::SeqIO::excel',
62 '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',
63 'SVG::Graph' => '0.01/creating SVG images/Bio::TreeIO::svggraph',
64 'Text::ParseWords' => '0/test scripts/Bio::DB::SeqFeature::Store::FeatureFileLoader',
65 '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',
66 'XML::DOM::XPath' => '0.13/parsing interpro features/Bio::FeatureIO::interpro',
67 'XML::Parser' => '0/parsing xml/Bio::Biblio::IO::medlinexml',
68 'XML::Parser::PerlSAX' => '0/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
69 'XML::SAX' => '0.15/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
70 'XML::SAX::Writer' => '0/writing xml/Bio::SeqIO::tigrxml',
71 'XML::Twig' => '0/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils',
72 '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',
73 'Math::Random' => '0/Random Phylogenetic Networks/Bio::PhyloNetwork::RandomFactory',
74 'Algorithm::Munkres' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
75 'Array::Compare' => '0/Phylogenetic Networks/Bio::PhyloNetwork',
76 'GraphViz' => '0/Phylogenetic Network Visulization/Bio::PhyloNetwork::GraphViz',
78 get_options => {
79 network => { } # say 'perl Build.PL --network' to manually request network tests
81 auto_features => {
82 BioDBSeqFeature_BDB => {
83 description => "BDB tests for Bio::DB::SeqFeature::Store",
84 feature_requires => { 'DB_File' => 0 } # feature_requires is like requires, execpt that it doesn't trigger installation
86 BioDBGFF => {
87 description => "BioDBGFF database tests (will need to answer questions before really enabling)",
88 feature_requires => { 'DBI' => 0 },
89 excludes_os => ['mswin'],
90 test => \&test_biodbgff # Bio::Root::Build unique requirement that after everything else succeeds, supplied code ref must also return undef
92 BioDBSeqFeature_mysql => {
93 description => "MySQL tests for Bio::DB::SeqFeature::Store",
94 feature_requires => { 'DBI' => 0, 'DBD::mysql' => 0 },
95 test => \&test_db_sf
97 Network => {
98 description => "Enable tests that need an internet connection",
99 requires => { 'LWP::UserAgent' => 0 },
100 test => \&Bio::Root::Build::test_internet
103 dynamic_config => 1,
104 create_makefile_pl => 'passthrough',
105 recursive_test_files => 1
107 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
108 #script_files => [] # scripts in scripts directory are installed on-demand
111 my $accept = $build->args->{accept};
113 prompt_for_biodb($accept) if $build->feature('BioDBGFF') || $build->feature('BioDBSeqFeature_mysql');
115 # Handle auto features
116 if ($build->feature('BioDBSeqFeature_BDB')) {
117 # will return without doing anything if user chose not to run tests during
118 # prompt_for_biodb() above
119 make_bdb_test();
121 if ($build->feature('BioDBSeqFeature_mysql')) {
122 make_dbi_test();
125 # Ask questions
126 $build->choose_scripts($accept);
127 #prompt_for_biodbgff($accept) if $build->feature('BioDBGFF');
129 if ($build->args('network')) {
130 if ($build->feature('Network')) {
131 $build->notes(network => 1);
132 $build->log_info(" - will run internet-requiring tests\n");
134 else {
135 $build->notes(network => 0);
136 $build->log_info(" - will not run network tests since I seem to be missing essential network functionality\n");
139 else {
140 $build->prompt_for_network($accept) if $build->feature('Network');
142 # then in test script:
143 # use Module::Build;
144 # my $build = Module::Build->current;
145 # my $do_network_tests = $build->notes('network');
148 # Request that some scripts run post-installation
149 $build->add_post_install_script('maintenance/symlink_script.pl'); # takes a unix file path regardless of local OS
151 # Add extra things to MANIFEST.SKIP
152 $build->add_to_manifest_skip('bioperl.lisp', 'Bio/Tools/WebBlat.pm');
154 # Create the build script and exit
155 $build->create_build_script;
157 exit;
160 sub make_bdb_test {
161 my $path0 = File::Spec->catfile('t', 'LocalDB', 'SeqFeature.t');
162 my $path = File::Spec->catfile('t', 'LocalDB','SeqFeature_BDB.t');
163 unlink($path) if (-e $path);
164 open(my $F, ">", $path) || die "Can't create test file\n";
165 print $F <<END;
166 system 'perl $path0 -adaptor berkeleydb -create 1 -temp 1';
168 close $F;
169 $build->add_to_cleanup($path);
170 $build->add_to_manifest_skip($path);
173 sub test_db_sf {
174 eval {require DBI;}; # if not installed, this sub won't actually be called
175 @drivers = DBI->available_drivers;
176 unless (grep {/mysql/i} @drivers) {
177 $mysql_ok = 0;
178 return "Only MySQL DBI driver supported for Bio::DB::SeqFeature MySQL tests";
180 $mysql_ok = 1;
181 return;
184 sub make_dbi_test {
185 my $dsn = $build->notes('test_dsn') || return;
186 my $path0 = File::Spec->catfile('t', 'LocalDB', 'SeqFeature.t');
187 my $path = File::Spec->catfile('t', 'LocalDB', 'SeqFeature_mysql.t');
188 my $test_db = $build->notes('test_db');
189 my $user = $build->notes('test_user');
190 my $pass = $build->notes('test_pass');
191 open my $F,">$path";
192 my $str = "$path0 -adaptor DBI::mysql -create 1 -temp 1 -dsn $dsn";
193 $str .= " -user $user" if $user;
194 $str .= " -password $pass" if $pass;
195 print $F <<END;
196 system 'perl $str';
198 close $F;
199 $build->add_to_cleanup($path);
200 $build->add_to_manifest_skip($path);
203 sub test_biodbgff {
204 eval {require DBI;}; # if not installed, this sub won't actually be called
205 @drivers = DBI->available_drivers;
206 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
207 return "MySQL, Pg nor Oracle DBI drivers are installed";
209 return;
212 sub prompt_for_biodb {
213 my $accept = shift;
214 my $proceed = $accept ? 0 : $build->y_n("Do you want to run the Bio::DB::GFF or ".
215 "Bio::DB::SeqFeature::Store MySQL live database tests? ".
216 "y/n", 'n');
218 if ($proceed) {
219 my @driver_choices;
220 foreach my $poss ('mysql', 'Pg', 'Oracle') {
221 if (grep {/$poss/i} @drivers) {
222 my $choice = $poss;
223 $choice =~ s/^(.)/[$1]/;
224 push(@driver_choices, $choice);
228 my $driver;
229 if (@driver_choices > 1) {
230 my ($default) = $driver_choices[0] =~ /\[(.)/;
231 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
233 else {
234 ($driver) = $driver_choices[0] =~ /\[(.)/;
236 if ($driver =~ /^[mM]/) {
237 $driver = 'mysql';
239 elsif ($driver =~ /^[pP]/) {
240 $driver = 'Pg';
242 elsif ($driver =~ /^[oO]/) {
243 $driver = 'Oracle';
246 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?", 'test');
247 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
248 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
249 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
251 my $use_host = 1;
252 if ($test_host eq 'undef' || $test_host eq 'localhost') {
253 $use_host = 0;
256 my $test_dsn;
257 if ($driver eq 'Pg') {
258 $test_dsn = "dbi:$driver:dbname=$test_db";
259 $mysql_ok = 0;
261 else {
262 $test_dsn = "dbi:$driver:database=$test_db";
263 $mysql_ok = 0;
265 if ($use_host) {
266 $test_dsn .= ";host=$test_host";
269 $build->notes(dbd_driver => $driver);
270 $build->notes(test_db => $test_db);
271 $build->notes(test_host => $test_host);
272 $build->notes(test_user => $test_user eq 'undef' ? undef : $test_user);
273 $build->notes(test_pass => $test_pass eq 'undef' ? undef : $test_pass);
274 $build->notes(test_dsn => $test_dsn);
276 $build->log_info(" - will run tests with database driver '$driver' and these settings:\n",
277 " Database $test_db\n",
278 " Host $test_host\n",
279 " DSN $test_dsn\n",
280 " User $test_user\n",
281 " Password $test_pass\n");
282 $build->log_info(" - will not run the BioDBSeqFeature_mysql live ".
283 "database tests (requires MySQL driver)\n") unless $mysql_ok;
285 else {
286 $build->log_info(" - will not run the BioDBGFF or BioDBSeqFeature live database tests\n");
289 $build->log_info("\n");