@@ -55,7 +55,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
55
55
self .AddDefine (slepcconf ,'PETSC_ARCH' ,petsc .arch )
56
56
self .AddDefine (slepcconf ,'DIR' ,slepc .dir )
57
57
self .AddDefine (slepcconf ,'LIB_DIR' ,os .path .join (slepc .prefixdir ,'lib' ))
58
- if slepc .isrepo :
58
+ if slepc .isrepo and slepc . gitrev != 'unknown' :
59
59
self .AddDefine (slepcconf ,'VERSION_GIT' ,slepc .gitrev )
60
60
self .AddDefine (slepcconf ,'VERSION_DATE_GIT' ,slepc .gitdate )
61
61
self .AddDefine (slepcconf ,'VERSION_BRANCH_GIT' ,slepc .branch )
@@ -69,7 +69,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
69
69
70
70
def ShowInfo (self ):
71
71
self .log .Println ('\n SLEPc directory:\n ' + self .dir )
72
- if self .isrepo :
72
+ if self .isrepo and self . gitrev != 'unknown' :
73
73
self .log .Println (' It is a git repository on branch: ' + self .branch )
74
74
if self .isinstall :
75
75
self .log .Println ('SLEPc prefix directory:\n ' + self .prefixdir )
@@ -110,28 +110,36 @@ def LoadVersion(self):
110
110
# Check whether this is a working copy of the repository
111
111
self .isrepo = False
112
112
if os .path .exists (os .path .join (self .dir ,'src' ,'docs' )):
113
+ self .log .write ('This appears to be a repository clone - src/docs exists' )
113
114
self .isrepo = True
114
- (status , output ) = self .RunCommand ('git help' )
115
- if status :
116
- self .log .Warn ('SLEPC_DIR appears to be a git working copy, but git is not found in PATH' )
117
- self .gitrev = 'unknown'
118
- self .gitdate = 'unknown'
119
- self .branch = 'unknown'
120
- else :
121
- (status , output ) = self .RunCommand ('git rev-parse' )
115
+ if os .path .exists (os .path .join (self .dir ,'.git' )):
116
+ self .log .write ('.git directory exists' )
117
+ (status , output ) = self .RunCommand ('git help' )
122
118
if status :
123
- self .log .Warn ('SLEPC_DIR appears to be a git working copy, but the . git folder is missing ' )
119
+ self .log .Warn ('SLEPC_DIR appears to be a git working copy, but git is not found in PATH ' )
124
120
self .gitrev = 'unknown'
125
121
self .gitdate = 'unknown'
126
122
self .branch = 'unknown'
127
123
else :
128
- (status , self .gitrev ) = self .RunCommand ('git describe' )
124
+ (status , self .gitrev ) = self .RunCommand ('git describe --match=v* ' )
129
125
if not self .gitrev :
130
126
(status , self .gitrev ) = self .RunCommand ('git log -1 --pretty=format:%H' )
131
127
(status , self .gitdate ) = self .RunCommand ('git log -1 --pretty=format:%ci' )
132
128
(status , self .branch ) = self .RunCommand ('git describe --contains --all HEAD' )
133
129
if status :
134
- self .branch = 'unknown'
130
+ (status , self .branch ) = self .RunCommand ('git rev-parse --abbrev-ref HEAD' )
131
+ if status :
132
+ self .branch = 'unknown'
133
+ else :
134
+ self .log .write ('This repository clone is obtained as a tarball as no .git dirs exist' )
135
+ self .gitrev = 'unknown'
136
+ self .gitdate = 'unknown'
137
+ self .branch = 'unknown'
138
+ else :
139
+ if os .path .exists (os .path .join (self .dir ,'.git' )):
140
+ self .log .Exit ('Your SLEPc source tree is broken. Use "git status" to check, or remove the entire directory and start all over again' )
141
+ else :
142
+ self .log .write ('This is a tarball installation' )
135
143
136
144
def CreateFile (self ,basedir ,fname ):
137
145
''' Create file basedir/fname and return path string '''
0 commit comments