| 1 | package Glade::PerlProject; | ||
| 2 | 1 | ▶ | require 5.000; use strict 'vars', 'refs', 'subs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | # Copyright (c) 1999 Dermot Musgrove <dermot.musgrove@virgin.net> | ||
| 5 | # | ||
| 6 | # This library is released under the same conditions as Perl, that | ||
| 7 | # is, either of the following: | ||
| 8 | # | ||
| 9 | # a) the GNU General Public License as published by the Free | ||
| 10 | # Software Foundation; either version 1, or (at your option) any | ||
| 11 | # later version. | ||
| 12 | # | ||
| 13 | # b) the Artistic License. | ||
| 14 | # | ||
| 15 | # If you use this library in a commercial enterprise, you are invited, | ||
| 16 | # but not required, to pay what you feel is a reasonable fee to perl.org | ||
| 17 | # to ensure that useful software is available now and in the future. | ||
| 18 | # | ||
| 19 | # (visit http://www.perl.org/ or email donors@perlmongers.org for details) | ||
| 20 | |||
| 21 | BEGIN { | ||
| 22 | 1 | ▶ | use Carp qw(cluck); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | $SIG{__DIE__} = \&Carp::confess; | ||
| 24 | $SIG{__WARN__} = \&Carp::cluck; | ||
| 25 | 1 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | 1 | ▶ | use File::Path qw( mkpath ); # in use_Glade_Project |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 1 | ▶ | use File::Basename qw( basename dirname ); # in use_Glade_Project |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 1 | ▶ | use Cwd qw( chdir cwd ); # in use_Glade_Project |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | 1 | ▶ | use Sys::Hostname qw( hostname ); # in use_Glade_Project |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 0 | ▶ | use Glade::PerlSource qw(:VARS :METHODS ); # Source writing vars and methods |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 31 | use Glade::PerlUI; | ||
| 32 | use vars qw( | ||
| 33 | @ISA | ||
| 34 | $PACKAGE $VERSION $AUTHOR $DATE | ||
| 35 | %app_fields | ||
| 36 | $new | ||
| 37 | $convert | ||
| 38 | ); | ||
| 39 | # Tell interpreter who we are inheriting from | ||
| 40 | @ISA = qw( | ||
| 41 | Glade::PerlSource | ||
| 42 | Glade::PerlUI | ||
| 43 | ); | ||
| 44 | $PACKAGE = __PACKAGE__; | ||
| 45 | $VERSION = q(0.61); | ||
| 46 | $AUTHOR = q(Dermot Musgrove <dermot.musgrove@virgin.net>); | ||
| 47 | $DATE = q(Fri May 3 03:56:25 BST 2002); | ||
| 48 | |||
| 49 | %app_fields = ( | ||
| 50 | 'type' => 'glade2perl', | ||
| 51 | 'app' => { | ||
| 52 | 'use_modules' => undef, # Existing signal handler modules | ||
| 53 | 'allow_gnome' => undef, # Dont allow gnome widgets | ||
| 54 | 'allow_gnome_db'=> undef, # Dont allow gnome-db widgets | ||
| 55 | }, | ||
| 56 | 'run_options' => { | ||
| 57 | 'name' => __PACKAGE__, | ||
| 58 | 'version' => $VERSION, | ||
| 59 | 'author' => $AUTHOR, | ||
| 60 | 'date' => $DATE, | ||
| 61 | 'my_gtk_perl' => undef, # Get the version number from Gtk-Perl | ||
| 62 | # '0.6123' we have CPAN release 0.6123 (or equivalent) | ||
| 63 | # '19990901' we have CVS version of 1st Sep 1999 | ||
| 64 | 'my_gnome_libs' => undef, # Get the version number from gnome_libs | ||
| 65 | # '1.0.8' we have release 1.0.8 (or equivalent) | ||
| 66 | # '19990901' we have CVS version of 1st Sep 1999 | ||
| 67 | 'dont_show_UI' => undef, # Show UI and wait | ||
| 68 | }, | ||
| 69 | 'glade' => { | ||
| 70 | 'name_from' => undef, | ||
| 71 | 'file' => undef, | ||
| 72 | 'encoding' => 'ISO-8859-1', # Character encoding eg ('ISO-8859-1') | ||
| 73 | 'project' => undef, # project proto | ||
| 74 | 'proto' => undef, # widget file proto | ||
| 75 | 'string' => undef, | ||
| 76 | }, | ||
| 77 | 'source' => { | ||
| 78 | 'indent' => ' ', # Source code indent per Gtk 'nesting' | ||
| 79 | 'tabwidth' => 8, # Replace each 8 spaces with a tab in sources | ||
| 80 | 'tab' => '', | ||
| 81 | 'write' => undef, # Dont write source code | ||
| 82 | 'quick_gen' => 0, # 1 = Don't perform any checks | ||
| 83 | 'save_connect_id'=> 0, # 1 = generate code to save signal_connect ids | ||
| 84 | 'hierarchy' => '', # Dont generate any hierarchy | ||
| 85 | # widget... | ||
| 86 | # eg $hier->{'vbox2'}{'table1'}... | ||
| 87 | # class... startswith class | ||
| 88 | # eg $hier->{'GtkVBox'}{'vbox2'}{'GtkTable'}{'table1'}... | ||
| 89 | # both... widget and class | ||
| 90 | 'style' => 'AUTOLOAD', # Generate code using OO AUTOLOAD code | ||
| 91 | # Libglade generate libglade code | ||
| 92 | # closures generate code using closures | ||
| 93 | # Export generate non-OO code | ||
| 94 | 'LANG' => ($ENV{'LANG'} || ''), | ||
| 95 | # Which language we want the source to be in | ||
| 96 | }, | ||
| 97 | 'module' => { | ||
| 98 | 'sigs' => { | ||
| 99 | 'class' => undef, | ||
| 100 | 'base' => undef, | ||
| 101 | 'file' => undef, | ||
| 102 | }, | ||
| 103 | 'ui' => { | ||
| 104 | 'class' => undef, | ||
| 105 | 'file' => undef, | ||
| 106 | }, | ||
| 107 | 'app' => { | ||
| 108 | 'class' => undef, | ||
| 109 | 'base' => undef, | ||
| 110 | 'file' => undef, | ||
| 111 | }, | ||
| 112 | 'subapp' => { | ||
| 113 | 'class' => undef, | ||
| 114 | 'file' => undef, | ||
| 115 | }, | ||
| 116 | 'libglade' => { | ||
| 117 | 'class' => undef, | ||
| 118 | 'file' => undef, | ||
| 119 | }, | ||
| 120 | 'pot' => { | ||
| 121 | 'class' => undef, | ||
| 122 | 'file' => undef, | ||
| 123 | }, | ||
| 124 | }, | ||
| 125 | 'test' => { | ||
| 126 | 'name' => undef, | ||
| 127 | 'directory' => undef, | ||
| 128 | 'first_form' => undef, | ||
| 129 | 'use_module' => undef, | ||
| 130 | }, | ||
| 131 | 'dist' => { | ||
| 132 | 'write' => 'True', | ||
| 133 | 'directory' => '', | ||
| 134 | 'Makefile_PL' => 'Makefile.PL', | ||
| 135 | 'MANIFEST_SKIP' => 'MANIFEST.SKIP', | ||
| 136 | 'test_directory'=> 't', | ||
| 137 | 'test_pl' => 'test.pl', | ||
| 138 | 'bin_directory' => 'bin', | ||
| 139 | 'bin' => undef, # name of bin (script) to generate | ||
| 140 | 'rpm' => undef, # Name of RPM to produce | ||
| 141 | 'spec' => undef, # Name of RPM spec file | ||
| 142 | 'type' => undef, # Type of distribution | ||
| 143 | 'compress' => undef, # How to compress the distribution | ||
| 144 | 'scripts' => undef, # Scripts that should be installed | ||
| 145 | 'docs' => undef, # Documentation that should be included | ||
| 146 | }, | ||
| 147 | 'doc' => { | ||
| 148 | 'write' => 'True', | ||
| 149 | 'directory' => 'Documentation', | ||
| 150 | 'COPYING' => 'COPYING', | ||
| 151 | 'Changelog' => 'Changelog', | ||
| 152 | 'FAQ' => 'FAQ', | ||
| 153 | 'INSTALL' => 'INSTALL', | ||
| 154 | 'NEWS' => 'NEWS', | ||
| 155 | 'README' => 'README', | ||
| 156 | 'ROADMAP' => 'ROADMAP', | ||
| 157 | 'TODO' => 'TODO', | ||
| 158 | }, | ||
| 159 | 'helper' => { | ||
| 160 | 'editors' => undef, # Editor calls that are available | ||
| 161 | 'active_editor' => undef, # Index of editor that we are using | ||
| 162 | }, | ||
| 163 | ); | ||
| 164 | |||
| 165 | $convert = { | ||
| 166 | 'author' => "\$new->{app}{author} = \$old->{author}", | ||
| 167 | 'version' => "\$new->{app}{version} = \$old->{version}", | ||
| 168 | 'date' => "\$new->{app}{date} = \$old->{date}", | ||
| 169 | 'copying' => "\$new->{app}{copying} = \$old->{copying}", | ||
| 170 | 'description' => "\$new->{app}{description} = \$old->{description}", | ||
| 171 | 'logo' => "\$new->{app}{logo} = \$old->{logo}", | ||
| 172 | 'use_modules' => "\$new->{app}{use_modules} = \$old->{use_modules}", | ||
| 173 | 'allow_gnome' => "\$new->{app}{allow_gnome} = \$old->{allow_gnome}", | ||
| 174 | 'allow_gnome_db' => "\$new->{app}{allow_gnome_db} = \$old->{allow_gnome_db}", | ||
| 175 | |||
| 176 | 'glade_encoding' => "\$new->{glade}{encoding} = \$old->{glade_encoding}", | ||
| 177 | 'glade_filename' => "\$new->{glade}{file} = \$old->{glade_filename}", | ||
| 178 | 'xml' => "\$new->{glade}{string} = \$old->{xml}", | ||
| 179 | |||
| 180 | 'start_time' => "\$new->{glade2perl}{start_time} = \$old->{start_time}", | ||
| 181 | 'project_options' => "\$new->{glade2perl}{xml}{project} = \$old->{project_options}", | ||
| 182 | 'site_options' => "\$new->{glade2perl}{xml}{site} = \$old->{site_options}", | ||
| 183 | 'user_options' => "\$new->{glade2perl}{xml}{user} = \$old->{user_options}", | ||
| 184 | 'options_set' => "\$new->{glade2perl}{xml}{set_by} = \$old->{options_set}", | ||
| 185 | 'glade2perl_encoding' => "\$new->{glade2perl}{xml}{encoding}= \$old->{glade2perl_encoding}", | ||
| 186 | 'glade2perl_version' => "\$new->{glade2perl}{version} = \$old->{glade2perl_version}", | ||
| 187 | 'glade2perl_logo' => "\$new->{glade2perl}{logo} = \$old->{glade2perl_logo}", | ||
| 188 | 'dont_show_UI' => "\$new->{glade2perl}{dont_show_UI} = \$old->{dont_show_UI}", | ||
| 189 | 'my_perl_gtk' => "\$new->{glade2perl}{my_gtk_perl} = \$old->{my_perl_gtk}", | ||
| 190 | 'my_gnome_libs' => "\$new->{glade2perl}{my_gnome_libs}= \$old->{my_gnome_libs}", | ||
| 191 | |||
| 192 | 'indent' => "\$new->{source}{indent} = \$old->{indent};". | ||
| 193 | "\$new->{diag}{indent} = \$old->{indent};}", | ||
| 194 | 'tabwidth' => "\$new->{source}{tabwidth} = \$old->{tabwidth};". | ||
| 195 | "\$new->{diag}{tabwidth} = \$new->{source}{tabwidth};}", | ||
| 196 | 'write_source' => "\$new->{source}{write} = \$old->{write_source}", | ||
| 197 | 'hierarchy' => "\$new->{source}{hierarchy} = \$old->{hierarchy}", | ||
| 198 | 'style' => "\$new->{source}{style} = \$old->{style}", | ||
| 199 | 'source_LANG' => "\$new->{source}{LANG} = \$old->{source_LANG}", | ||
| 200 | |||
| 201 | 'verbose' => "\$new->{diag}{verbose} = \$old->{verbose}", | ||
| 202 | 'diag_wrap' => "\$new->{diag}{wrap_at} = \$old->{diag_wrap}", | ||
| 203 | 'autoflush' => "\$new->{diag}{autoflush} = \$old->{autoflush}", | ||
| 204 | 'benchmark' => "\$new->{diag}{benchmark} = \$old->{benchmark}", | ||
| 205 | 'log_file' => "\$new->{diag}{log} = \$old->{log_file}", | ||
| 206 | 'diag_LANG' => "\$new->{diag}{LANG} = \$old->{diag_LANG}", | ||
| 207 | |||
| 208 | 'dist_type' => "\$new->{dist}{type} = \$old->{dist_type}", | ||
| 209 | 'dist_compress' => "\$new->{dist}{compress} = \$old->{dist_compress}", | ||
| 210 | 'dist_scripts' => "\$new->{dist}{scripts} = \$old->{dist_scripts}", | ||
| 211 | 'dist_docs' => "\$new->{dist}{docs} = \$old->{dist_docs}", | ||
| 212 | |||
| 213 | 'editors' => "\$new->{helper}{editors} = \$old->{editors}", | ||
| 214 | 'active_editor' => "\$new->{helper}{active_editor} = \$old->{active_editor}", | ||
| 215 | }; | ||
| 216 | } | ||
| 217 | |||
| 218 | sub DESTROY { | ||
| 219 | # This sub will be called on object destruction | ||
| 220 | } # End of sub DESTROY | ||
| 221 | |||
| 222 | #=============================================================================== | ||
| 223 | #=========== Project utilities ============ | ||
| 224 | #=============================================================================== | ||
| 225 | sub Writing_Source_only { shift->glade2perl->dont_show_UI } | ||
| 226 | |||
| 227 | sub get_versions { | ||
| 228 | my ($class) = @_; | ||
| 229 | my $type = 'glade2perl'; | ||
| 230 | # We use the CPAN release date (or CVS date) for version checking | ||
| 231 | my $cpan_date = $Glade::PerlUI::gtk_perl_depends->{$Gtk::VERSION}; | ||
| 232 | |||
| 233 | # If we dont recognise the version number we use the latest CVS | ||
| 234 | # version that was available at our release date | ||
| 235 | $cpan_date ||= $Glade::PerlUI::gtk_perl_depends->{'LATEST_CVS'}; | ||
| 236 | |||
| 237 | # If we have a version number rather than CVS date we look it up again | ||
| 238 | $cpan_date = $Glade::PerlUI::gtk_perl_depends->{$cpan_date} | ||
| 239 | if ($cpan_date < 19000000); | ||
| 240 | |||
| 241 | if ($class->{$type}->my_gtk_perl && | ||
| 242 | ($class->{$type}->my_gtk_perl > $cpan_date)) { | ||
| 243 | $Glade_Perl->diag_print (2, "%s- %s reported version %s". | ||
| 244 | " but user overrode with version %s", | ||
| 245 | $indent, "Gtk-Perl", "$Gtk::VERSION (CVS $cpan_date)", | ||
| 246 | $class->{$type}->my_gtk_perl); | ||
| 247 | |||
| 248 | } else { | ||
| 249 | $class->{$type}->my_gtk_perl($cpan_date); | ||
| 250 | $Glade_Perl->diag_print (2, "%s- %s reported version %s", | ||
| 251 | $indent, "Gtk-Perl", "$Gtk::VERSION (CVS $cpan_date)"); | ||
| 252 | } | ||
| 253 | unless ($class->my_gtk_perl_can_do('MINIMUM REQUIREMENTS')) { | ||
| 254 | die "You need to upgrade your Gtk-Perl"; | ||
| 255 | } | ||
| 256 | |||
| 257 | if ($class->app->allow_gnome) { | ||
| 258 | my $gnome_libs_version = `gnome-config --version`; | ||
| 259 | chomp $gnome_libs_version; | ||
| 260 | $gnome_libs_version =~ s/gnome-libs //; | ||
| 261 | if ($class->{$type}->my_gnome_libs && | ||
| 262 | ($class->{$type}->my_gnome_libs gt $gnome_libs_version)) { | ||
| 263 | $Glade_Perl->diag_print (2, "%s- %s reported version %s". | ||
| 264 | " but user overrode with version %s", | ||
| 265 | $indent, "gnome-libs", $gnome_libs_version, | ||
| 266 | $class->{$type}->my_gnome_libs); | ||
| 267 | } else { | ||
| 268 | $class->{$type}->my_gnome_libs($gnome_libs_version); | ||
| 269 | $Glade_Perl->diag_print (2, "%s- %s reported version %s", | ||
| 270 | $indent, "gnome-libs", $gnome_libs_version); | ||
| 271 | } | ||
| 272 | unless ($class->my_gnome_libs_can_do('MINIMUM REQUIREMENTS')) { | ||
| 273 | die "You need to upgrade your gnome-libs"; | ||
| 274 | } | ||
| 275 | } | ||
| 276 | |||
| 277 | return $class; | ||
| 278 | } | ||
| 279 | |||
| 280 | sub use_Glade_Project { | ||
| 281 | my ($class, $glade_proto) = @_; | ||
| 282 | my $me = (ref $class || $class)."->use_Glade_Project"; | ||
| 283 | my $type = 'glade2perl'; | ||
| 284 | |||
| 285 | $Glade_Perl->diag_print(6, $glade_proto->{'project'}, "Input Proto project"); | ||
| 286 | |||
| 287 | my $proj_opt = bless {}, (ref $class || $class); | ||
| 288 | |||
| 289 | $proj_opt->{app}{allow_gnome} = ($class->normalise( | ||
| 290 | $glade_proto->{'project'}{'gnome_support'} || 'True') == 1); | ||
| 291 | $proj_opt->{app}{allow_gnome_db} =($class->normalise( | ||
| 292 | $glade_proto->{'project'}{'gnome_db_support'} || 'False') == 1); | ||
| 293 | |||
| 294 | # Remove any spaces, dots or minuses in the project name | ||
| 295 | # These are invalid in perl package name | ||
| 296 | $glade_proto ->{'project'}{'name'} = | ||
| 297 | $class->fix_name($glade_proto ->{'project'}{'name'}); | ||
| 298 | # my $replaced = $glade_proto ->{'project'}{'name'} =~ s/[ -\.]//g; | ||
| 299 | # if ($replaced) { | ||
| 300 | # $Glade_Perl->diag_print(2, "%s- %s Space(s), minus(es) or dot(s) ". | ||
| 301 | # "removed from project name - it is now '%s'", | ||
| 302 | # $indent, $replaced, $glade_proto->{'project'}{'name'}); | ||
| 303 | # } | ||
| 304 | $proj_opt->{app}{name} = $glade_proto->{'project'}{'name'}; | ||
| 305 | $proj_opt->{app}{program} = $glade_proto->{'project'}{'program_name'}; | ||
| 306 | |||
| 307 | # Glade assumes that all directories are named relative to the Glade | ||
| 308 | # project (.glade) file (not <project><directory>) ! | ||
| 309 | $proj_opt->{glade}{file} = $class->full_Path( | ||
| 310 | $Glade_Perl->glade->file, `pwd`); | ||
| 311 | $proj_opt->{glade}{start_directory} = dirname($proj_opt->{glade}{file}); | ||
| 312 | |||
| 313 | $proj_opt->{glade}{directory} = $class->full_Path( | ||
| 314 | $glade_proto->{project}{directory}, | ||
| 315 | $proj_opt->{glade}{start_directory}, | ||
| 316 | $proj_opt->{glade}{start_directory}); | ||
| 317 | |||
| 318 | $proj_opt->{diag}{log} = $class->full_Path( | ||
| 319 | $Glade_Perl->diag->log, | ||
| 320 | $proj_opt->{glade}{start_directory} | ||
| 321 | ) if $Glade_Perl->diag->log and $Glade_Perl->diag->log ne $NOFILE; | ||
| 322 | |||
| 323 | $proj_opt->{$type}{xml}{project} = $class->full_Path( | ||
| 324 | $Glade_Perl->{$type}->xml->project, | ||
| 325 | `pwd`, | ||
| 326 | # $proj_opt->{glade}{directory}, | ||
| 327 | ) unless $Glade_Perl->{$type}->xml->project eq $NOFILE; | ||
| 328 | |||
| 329 | $proj_opt->{module}{directory} = $class->full_Path( | ||
| 330 | ($glade_proto->{project}{source_directory} || './src'), | ||
| 331 | $proj_opt->{glade}{start_directory}, | ||
| 332 | $proj_opt->{glade}{start_directory} ); | ||
| 333 | |||
| 334 | $proj_opt->{glade}{pixmaps_directory} = $class->full_Path( | ||
| 335 | ($glade_proto->{'project'}{'pixmaps_directory'} || './pixmaps'), | ||
| 336 | $proj_opt->{glade}{start_directory}, | ||
| 337 | $proj_opt->{glade}{start_directory} ); | ||
| 338 | |||
| 339 | if ($Glade_Perl->Writing_to_File) { | ||
| 340 | unless (-d $proj_opt->{module}{directory}) { | ||
| 341 | # Source directory does not exist yet so create it | ||
| 342 | $Glade_Perl->diag_print (2, "%s- Creating source_directory '%s' in %s", | ||
| 343 | $indent, $proj_opt->{module}{directory}, $me); | ||
| 344 | mkpath($proj_opt->{module}{directory} ); | ||
| 345 | } | ||
| 346 | |||
| 347 | unless (-d $proj_opt->{glade}{pixmaps_directory}) { | ||
| 348 | # Pixmaps directory does not exist yet so create it | ||
| 349 | $Glade_Perl->diag_print (2, "%s- Creating pixmaps_directory '%s' in %s", | ||
| 350 | $indent, $proj_opt->{glade}{pixmaps_directory}, $me); | ||
| 351 | mkpath($proj_opt->{glade}{pixmaps_directory} ); | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 | my $src = $proj_opt->{module}{directory}; | ||
| 356 | |||
| 357 | $proj_opt->{module}{sigs}{class} = "$proj_opt->{app}{name}SIGS"; | ||
| 358 | $proj_opt->{module}{sigs}{base} = "$src/$proj_opt->{module}{sigs}{class}"; | ||
| 359 | $proj_opt->{module}{sigs}{file} = "$proj_opt->{module}{sigs}{base}.pm"; | ||
| 360 | |||
| 361 | $proj_opt->{module}{ui}{class} = "$proj_opt->{app}{name}UI"; | ||
| 362 | $proj_opt->{module}{ui}{base} = "$src/$proj_opt->{module}{ui}{class}"; | ||
| 363 | $proj_opt->{module}{ui}{file} = "$proj_opt->{module}{ui}{base}.pm"; | ||
| 364 | |||
| 365 | $proj_opt->{module}{app}{class} = "$proj_opt->{app}{name}"; | ||
| 366 | $proj_opt->{module}{app}{base} = "$src/$proj_opt->{module}{app}{class}"; | ||
| 367 | $proj_opt->{module}{app}{file} = "$proj_opt->{module}{app}{base}.pm"; | ||
| 368 | |||
| 369 | $proj_opt->{module}{subapp}{class} = "Sub$proj_opt->{module}{app}{class}"; | ||
| 370 | $proj_opt->{module}{subapp}{file} = "$src/$proj_opt->{module}{subapp}{class}.pm"; | ||
| 371 | |||
| 372 | $proj_opt->{module}{libglade}{class} = "$proj_opt->{app}{name}"; | ||
| 373 | $proj_opt->{module}{libglade}{file} = "$src/$proj_opt->{module}{libglade}{class}LIBGLADE.pm"; | ||
| 374 | |||
| 375 | $proj_opt->{module}{pot}{file} = "$src/$proj_opt->{app}{name}.pot"; | ||
| 376 | |||
| 377 | $proj_opt->{app}{logo} = $class->full_Path( | ||
| 378 | $Glade_Perl->app->logo, | ||
| 379 | $proj_opt->{glade}{'pixmaps_directory'}, | ||
| 380 | '' ); | ||
| 381 | |||
| 382 | $proj_opt->{$type}{logo} = $class->full_Path( | ||
| 383 | $Glade_Perl->{$type}->logo, | ||
| 384 | $proj_opt->{glade}{pixmaps_directory}, | ||
| 385 | '' ); | ||
| 386 | |||
| 387 | unless (-r $proj_opt->{$type}{logo}) { | ||
| 388 | $Glade_Perl->diag_print (2, "%s- Writing our own logo to '%s' in %s", | ||
| 389 | $indent, $proj_opt->{$type}{logo}, $me); | ||
| 390 | open LOGO, ">$proj_opt->{$type}{logo}" or | ||
| 391 | die sprintf("error %s - can't open file '%s' for output", | ||
| 392 | $me, $proj_opt->{$type}{logo}); | ||
| 393 | print LOGO $class->our_logo; | ||
| 394 | close LOGO or | ||
| 395 | die sprintf("error %s - can't close file '%s'", | ||
| 396 | $me, $proj_opt->{$type}{logo}); | ||
| 397 | } | ||
| 398 | |||
| 399 | unless (-r $proj_opt->{app}{logo}) { | ||
| 400 | $Glade_Perl->diag_print (2, "%s- Writing our own logo to '%s' in %s", | ||
| 401 | $indent, $proj_opt->{app}{logo}, $me); | ||
| 402 | open LOGO, ">$proj_opt->{app}{logo}" or | ||
| 403 | die sprintf("error %s - can't open file '%s' for output", | ||
| 404 | $me, $proj_opt->{app}{logo}); | ||
| 405 | print LOGO $class->our_logo; | ||
| 406 | close LOGO or | ||
| 407 | die sprintf("error %s - can't close file '%s'", | ||
| 408 | $me, $proj_opt->{app}{logo}); | ||
| 409 | } | ||
| 410 | |||
| 411 | unless ($proj_opt->{app}{logo} && -r $proj_opt->{app}{logo}) { | ||
| 412 | $proj_opt->{app}{logo} = $proj_opt->{$type}{logo}; | ||
| 413 | } | ||
| 414 | |||
| 415 | $proj_opt->{dist}{directory} = $class->full_Path( | ||
| 416 | $proj_opt->{dist}{directory}, $proj_opt->{glade}{directory}); | ||
| 417 | |||
| 418 | unless (-d $proj_opt->{dist}{directory}) { | ||
| 419 | # Source directory does not exist yet so create it | ||
| 420 | $Glade_Perl->diag_print (2, "%s- Creating distribution '%s' in %s", | ||
| 421 | $indent, $proj_opt->{dist}{directory}, $me); | ||
| 422 | mkpath($proj_opt->{dist}{directory} ); | ||
| 423 | } | ||
| 424 | $proj_opt->{dist}{bin_directory} = $class->full_Path( | ||
| 425 | ($proj_opt->{dist}{bin_directory} || './bin'), | ||
| 426 | $proj_opt->{dist}{directory}, | ||
| 427 | $proj_opt->{dist}{directory} ); | ||
| 428 | unless (-d $proj_opt->{dist}{bin_directory}) { | ||
| 429 | # bin directory does not exist yet so create it | ||
| 430 | $Glade_Perl->diag_print (2, "%s- Creating directory '%s' in %s", | ||
| 431 | $indent, $proj_opt->{dist}{bin_directory}, $me); | ||
| 432 | mkpath($proj_opt->{dist}{bin_directory} ); | ||
| 433 | } | ||
| 434 | $proj_opt->{dist}{bin} = $class->full_Path( | ||
| 435 | ($glade_proto->{project}{program_name} || 'run_'.$proj_opt->app->name), | ||
| 436 | $proj_opt->{dist}{bin_directory} ); | ||
| 437 | |||
| 438 | $proj_opt->{dist}{test_directory} = $class->full_Path( | ||
| 439 | ($proj_opt->{dist}{test_directory} || './t'), | ||
| 440 | $proj_opt->{dist}{directory}, | ||
| 441 | $proj_opt->{dist}{directory} ); | ||
| 442 | unless (-d $proj_opt->{dist}{test_directory}) { | ||
| 443 | # bin directory does not exist yet so create it | ||
| 444 | $Glade_Perl->diag_print (2, "%s- Creating directory '%s' in %s", | ||
| 445 | $indent, $proj_opt->{dist}{test_directory}, $me); | ||
| 446 | mkpath($proj_opt->{dist}{test_directory} ); | ||
| 447 | } | ||
| 448 | $proj_opt->{dist}{test_pl} = $class->full_Path( | ||
| 449 | ($proj_opt->{dist}{test_pl} || './01.t'), | ||
| 450 | $proj_opt->{dist}{test_directory} ); | ||
| 451 | |||
| 452 | if ($Glade_Perl->app->author) { | ||
| 453 | $proj_opt->{app}{author} = $Glade_Perl->app->author; | ||
| 454 | } else { | ||
| 455 | my $host = hostname; | ||
| 456 | my $pwuid = [(getpwuid($<))]; | ||
| 457 | my $user = $pwuid->[0]; | ||
| 458 | my $fullname = $pwuid->[6]; | ||
| 459 | my $hostname = [split(" ", $host)]; | ||
| 460 | $proj_opt->{app}{'author'} = "$fullname <$user\@$hostname->[0]>"; | ||
| 461 | } | ||
| 462 | # Remove trailing spaces and ensure only one leading '#' | ||
| 463 | $Glade_Perl->{app}{copying} =~ s/ *$//; | ||
| 464 | if ($Glade_Perl->app->copying !~ /^#/) { | ||
| 465 | $Glade_Perl->app->copying("#".$Glade_Perl->app->copying); | ||
| 466 | } | ||
| 467 | # escape any quotes | ||
| 468 | $proj_opt->{app}{'author'} =~ s/\"/\\\"/g; | ||
| 469 | $proj_opt->{app}{'author'} =~ s/\'/\\\'/g; | ||
| 470 | |||
| 471 | $proj_opt->{app}{'version'} ||= $Glade_Perl->app->version; | ||
| 472 | $proj_opt->{app}{'date'} ||= $Glade_Perl->app->date || $Glade_Perl->{$type}->start_time; | ||
| 473 | $proj_opt->{app}{'copying'} ||= $Glade_Perl->app->copying; | ||
| 474 | $proj_opt->{app}{'description'} ||= $Glade_Perl->app->description || 'No description'; | ||
| 475 | $proj_opt->{$type}->{xml}->{set_by}=($me); | ||
| 476 | |||
| 477 | # Now change to the <project><directory> so that we can find modules | ||
| 478 | chdir $proj_opt->{glade}{directory}; | ||
| 479 | |||
| 480 | $Glade_Perl->diag_print(6, $proj_opt); | ||
| 481 | return $proj_opt; | ||
| 482 | } | ||
| 483 | |||
| 484 | 1; | ||
| 485 | |||
| 486 | __END__ | ||