[svn:parrot] r36780 - in trunk/lib/Parrot: . Configure/Options

allison at svn.parrot.org allison at svn.parrot.org
Sun Feb 15 23:44:14 UTC 2009


Author: allison
Date: Sun Feb 15 23:44:14 2009
New Revision: 36780
URL: https://trac.parrot.org/parrot/changeset/36780

Log:
[config] Make the configuration process smarter about reading the version
information from a file. Allow more than one location for the file, so libs can
be used from an install.

Modified:
   trunk/lib/Parrot/BuildUtil.pm
   trunk/lib/Parrot/Configure/Options/Conf.pm

Modified: trunk/lib/Parrot/BuildUtil.pm
==============================================================================
--- trunk/lib/Parrot/BuildUtil.pm	Sun Feb 15 23:42:08 2009	(r36779)
+++ trunk/lib/Parrot/BuildUtil.pm	Sun Feb 15 23:44:14 2009	(r36780)
@@ -42,9 +42,18 @@
     }
 
     # Obtain the official version number from the VERSION file.
-    open my $VERSION, '<', 'VERSION' or die 'Could not open VERSION file!';
-    chomp( $parrot_version = <$VERSION> );
-    close $VERSION or die $!;
+    if (-e 'VERSION') {
+        open my $VERSION, '<', 'VERSION' or die 'Could not open VERSION file!';
+        chomp( $parrot_version = <$VERSION> );
+        close $VERSION or die $!;
+    }
+    else { # we're in an installed copy of Parrot
+        my $path = shift;
+	$path = '' unless $path;
+        open my $VERSION, '<', "$path/VERSION" or die 'Could not open VERSION file!';
+        chomp( $parrot_version = <$VERSION> );
+        close $VERSION or die $!;
+    }
 
     $parrot_version =~ s/\s+//g;
     @parrot_version = split( /\./, $parrot_version );

Modified: trunk/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Options/Conf.pm	Sun Feb 15 23:42:08 2009	(r36779)
+++ trunk/lib/Parrot/Configure/Options/Conf.pm	Sun Feb 15 23:44:14 2009	(r36780)
@@ -14,9 +14,10 @@
 );
 use lib qw( lib );
 use Parrot::BuildUtil ();
+use FindBin qw($Bin);
 
 our $script         = q{Configure.pl};
-our $parrot_version = Parrot::BuildUtil::parrot_version();
+our $parrot_version = Parrot::BuildUtil::parrot_version("$Bin/../../");
 our $svnid          = '$Id$';
 
 sub print_version {


More information about the parrot-commits mailing list