If parser overheats, turn off and back slowly away (small edits)
[bioperl-live.git] / Build.PL
bloba1e73bdd4a9ace4e41905fdd8b2055cf7af28d0d
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 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.
13 use strict;
14 use ModuleBuildBioperl;
16 our @drivers;
18 # Set up the ModuleBuildBioperl object
19 my $build = ModuleBuildBioperl->new(
20 module_name => 'Bio',
21 dist_name => 'bioperl',
22 dist_version_from => 'Bio/Root/Version.pm',
23 dist_author => 'Bioperl Team <bioperl-l@bioperl.org>',
24 dist_abstract => 'Bioinformatics Toolkit',
25 license => 'artistic',
26 requires => {
27 'perl' => '5.6.1',
28 'IO::String' => 0,
29 'DB_File' => 0
31 build_requires => {
32 'Test::More' => 0,
33 'Module::Build' => 0.2805,
34 'Test::Harness' => 2.62,
35 'CPAN' => 1.81
37 recommends => { # does what you would expect of recommends, except more informative output and generates optional_features in META.yml
38 'Ace' => '0/access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace',
39 # this won't actually install due to circular dep, but we have no way of doing a post-install
40 'Bio::ASN1::EntrezGene' => '0/parsing entrezgene/Bio::SeqIO::entrezgene',
41 # we actually need 1.01 of Class::AutoClass, but unfortunately it is versioned as 1.0
42 'Class::AutoClass' => '1/creating objects/Bio::Graph::SimpleGraph,Bio::Graph::SimpleGraph::Traversal,Bio::Graph::ProteinGraph',
43 'Clone' => '0/cloning objects/Bio::Graph::ProteinGraph,Bio::Tools::Primer3',
44 'Convert::Binary::C' => '0/strider functionality/Bio::SeqIO::strider',
45 'Data::Stag::XMLWriter' => '0/writing choas xml files/Bio::SeqIO::chaosxml',
46 'GD' => '1.3/rendering Sequences and Features/Bio::Graphics::Glyph*',
47 'GD::SVG' => '0/creating SVG images/Bio::Graphics::Panel',
48 # we specifically want Graph::Directed, but that has no VERSION
49 'Graph' => '0/ontology engine implementation for the GO parser/Bio::Ontology::SimpleGOEngine::GraphAdaptor',
50 'HTML::Entities' => '0/remote analysis POST submissions/Bio::SearchIO::blastxml',
51 'HTML::Parser' => '3/screen scraping www.gdb.org/Bio::DB::GDB',
52 '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*',
53 'LWP::UserAgent' => '0/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::WebBlat,Bio::WebAgent,Bio::Graphics::Glyph::image',
54 'PostScript::TextBlock' => '0/EPS output/Bio::Tree::Draw::Cladogram',
55 'Set::Scalar' => '0/proper operation/Bio::Tree::Compatible',
56 'SOAP::Lite' => '0/XEMBL Services and Bibliographic queries/Bio::DB::XEMBLService,Bio::DB::Biblio::soap',
57 'Spreadsheet::ParseExcel' => '0/parsing Excel files/Bio::SeqIO::excel',
58 'Storable' => '0/storing sequence objects in local file cache/Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb',
59 'SVG' => '2.26/SVG output/Bio::Graphics::Pictogram',
60 'SVG::Graph' => '0.01/creating SVG images/Bio::TreeIO::svggraph',
61 'Text::Shellwords' => '0/test scripts/Bio::Graphics',
62 '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',
63 'XML::DOM::XPath' => '0.13/parsing interpro features/Bio::FeatureIO::interpro',
64 'XML::Parser' => '0/parsing xml/Bio::Biblio::IO::medlinexml',
65 'XML::Parser::PerlSAX' => '0/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
66 'XML::SAX' => '0/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
67 'XML::SAX::Writer' => '0/writing xml/Bio::SeqIO::tigrxml',
68 # this is just required by XML::Simple, since installation will fail if only XML::SAX::PurePerl is installed
69 # should be able to remove this when XML::SAX is bug-fixed for this problem
70 # *** to get XML::SAX::ExpatXS to install before XML::Simple, we should recommend a bundle of the two,
71 # instead of recommending them directly... just need to make the bundle...
72 'XML::SAX::ExpatXS' => '0/parsing xml/XML::Simple',
73 'XML::Simple' => '0/parsing xml/Bio::DB::EUtilities',
74 'XML::Twig' => '0/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils,Bio::Graph::IO::psi_xml',
75 '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 get_options => {
78 network => { } # not actually used by anything yet, but in the future say perl Build.PL --network
80 auto_features => {
81 BioDBSeqFeature_BDB => {
82 description => "BDB tests for Bio::DB::SeqFeature::Store",
83 feature_requires => { 'DB_File' => 0 } # feature_requires is like requires, execpt that it doesn't trigger installation
85 BioDBGFF => {
86 description => "BioDBGFF database tests (will need to answer questions before really enabling)",
87 feature_requires => { 'DBI' => 0 },
88 excludes_os => ['mswin'],
89 test => \&test_biodbgff # ModuleBuildBioperl unique requirement that after everything else succeeds, supplied code ref must also return undef
91 BioDBSeqFeature_mysql => {
92 description => "MySQL tests for Bio::DB::SeqFeature::Store",
93 feature_requires => { 'DBI' => 0, 'DBD::mysql' => 0 },
94 test => \&test_db
96 # The following code works, but since no tests in the test suite actually make use of this functionality, don't use it yet
97 # Network => {
98 # description => "Enable tests that need an internet connection",
99 # requires => { 'LWP::UserAgent' => 0 },
100 # options => ['network'], # ModuleBuildBioperl unique requirement that --network was supplied
101 # test => \&ModuleBuildBioperl::test_internet
104 dynamic_config => 1,
105 create_makefile_pl => 'passthrough'
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 # Handle auto features
112 if ($build->feature('BioDBSeqFeature_BDB')) {
113 make_bdb_test();
115 if ($build->feature('BioDBSeqFeature_mysql')) {
116 make_dbi_test();
119 $build->notes(network => $build->feature('Network'));
120 # then in test script:
121 # use Module::Build;
122 # my $build = Module::Build->current;
123 # my $do_network_tests = $build->notes('network');
126 # Ask questions
127 $build->choose_scripts;
128 prompt_for_biodbgff() if $build->feature('BioDBGFF');
130 # Request that some scripts run post-installation
131 $build->add_post_install_script('maintenance/symlink_script.pl'); # takes a unix file path regardless of local OS
133 # Add extra things to MANIFEST.SKIP
134 $build->add_to_manifest_skip('bioperl.lisp', 'Bio/Tools/WebBlat.pm');
136 # Create the build script and exit
137 $build->create_build_script;
139 exit;
142 sub make_bdb_test {
143 my $path0 = File::Spec->catfile('t', 'BioDBSeqFeature.t');
144 my $path = File::Spec->catfile('t', 'BioDBSeqFeature_BDB.t');
145 open my $F, ">$path";
146 print $F <<END;
147 system 'perl $path0 -adaptor berkeleydb -create 1 -temp 1';
149 close $F;
150 $build->add_to_cleanup($path);
151 $build->add_to_manifest_skip($path);
154 sub test_db {
155 eval {require DBI;}; # if not installed, this sub won't actually be called
156 unless (eval {DBI->connect('dbi:mysql:test',undef,undef,{RaiseError=>0,PrintError=>0})}) {
157 return "Could not connect to test database";
159 return;
162 sub make_dbi_test {
163 my $path0 = File::Spec->catfile('t', 'BioDBSeqFeature.t');
164 my $path = File::Spec->catfile('t', 'BioDBSeqFeature_mysql.t');
165 open my $F,">$path";
166 print $F <<END;
167 system 'perl $path0 -adaptor DBI::mysql -create 1 -temp 1 -dsn test';
169 close $F;
170 $build->add_to_cleanup($path);
171 $build->add_to_manifest_skip($path);
174 sub test_biodbgff {
175 eval {require DBI;}; # if not installed, this sub won't actually be called
176 @drivers = DBI->available_drivers;
177 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
178 return "MySQL, Pg nor Oracle DBI drivers are installed";
180 return;
183 sub prompt_for_biodbgff {
184 my $proceed = $build->y_n("Do you want to run the BioDBGFF live database tests? y/n", 'n');
186 if ($proceed) {
187 my @driver_choices;
188 foreach my $poss ('mysql', 'Pg', 'Oracle') {
189 if (grep {/$poss/i} @drivers) {
190 my $choice = $poss;
191 $choice =~ s/^(.)/[$1]/;
192 push(@driver_choices, $choice);
196 my $driver;
197 if (@driver_choices > 1) {
198 my ($default) = $driver_choices[0] =~ /\[(.)/;
199 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
201 else {
202 ($driver) = $driver_choices[0] =~ /\[(.)/;
204 if ($driver =~ /^[mM]/) {
205 $driver = 'mysql';
207 elsif ($driver =~ /^[pP]/) {
208 $driver = 'Pg';
210 elsif ($driver =~ /^[oO]/) {
211 $driver = 'Oracle';
214 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?", 'test');
215 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
216 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
217 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
219 my $use_host = 1;
220 if ($test_host eq 'undef' || $test_host eq 'localhost') {
221 $use_host = 0;
224 my $test_dsn;
225 if ($driver eq 'Pg') {
226 $test_dsn = "dbi:$driver:dbname=$test_db";
228 else {
229 $test_dsn = "dbi:$driver:database=$test_db";
231 if ($use_host) {
232 $test_dsn .= ";host=$test_host";
235 $build->notes(dbd_driver => $driver);
236 $build->notes(test_db => $test_db);
237 $build->notes(test_host => $test_host);
238 $build->notes(test_user => $test_user eq 'undef' ? undef : $test_user);
239 $build->notes(test_pass => $test_pass eq 'undef' ? undef : $test_pass);
240 $build->notes(test_dsn => $test_dsn);
242 $build->log_info(" - will run the BioDBGFF tests with database driver '$driver' and these settings:\n",
243 " Database $test_db\n",
244 " Host $test_host\n",
245 " DSN $test_dsn\n",
246 " User $test_user\n",
247 " Password $test_pass\n");
249 else {
250 $build->log_info(" - will not run the BioDBGFF live database tests\n");
253 $build->log_info("\n");