You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by ni...@apache.org on 2003/05/05 00:55:09 UTC
cvs commit: jakarta-gump/python/gump check.py
nicolaken 2003/05/04 15:55:08
Added: python/gump check.py
Log:
New check.py file.
It checks that all the projects referenced are present.
In the current gump.xml profile it findes some errors. Run it to see :-)
Revision Changes Path
1.1 jakarta-gump/python/gump/check.py
Index: check.py
===================================================================
#!/usr/bin/python
"""
Checks that the Gump definitions are ok.
"""
import os.path
import os
import sys
import logging
from gump import load, buildSequence
from gump.conf import dir, default
from gump.model import Workspace, Module, Project
###############################################################################
# Initialize
###############################################################################
# use own logging
# init logging
logging.basicConfig()
# base gump logger
log = logging.getLogger(__name__)
#set verbosity to show all messages of severity >= default.logLevel
log.setLevel(default.logLevel)
###############################################################################
# Functions
###############################################################################
def check(workspace, projectname):
missing=[]
# for each project
for projectname in Project.list:
projectmissing = 0
print
print " TESTING " + projectname + " ************* "
project = Project.list[projectname]
# for each dependency in current project
for depend in project.depend+project.option:
# if the dependency is not present in the projects, it's missing
if depend.project not in Project.list:
projectmissing+=1
print " missing: "+depend.project
if depend.project not in missing:
missing.append(depend.project)
if missing>0:
print " total errors: " , projectmissing
if len(missing)>0:
print
print " ***** MISSING PROJECTS THAT ARE REFRENCED ***** "
print
for missed in missing:
print " " + missed
print
print " ***** RESULT ***** "
print
if len(missing)>0:
print " - ERROR - Some projects that were referenced are missing in the workspace. "
print " See the above messages for more detailed info."
else:
print " - OK - All projects that are referenced are present in the workspace."
print " ***** RESULT ***** "
return 0
# static void main()
if __name__=='__main__':
# load commandline args or use default values
if len(sys.argv)>1 :
ws=sys.argv[1]
else:
ws=default.workspace
if len(sys.argv)>2 :
ps=sys.argv[2]
else:
ps=default.project
# get parsed workspace definition
workspace=load(ws)
# check
result = check(workspace, ps);
# bye!
sys.exit(result)
Re: cvs commit: jakarta-gump/python/gump check.py
Posted by Nicola Ken Barozzi <ni...@apache.org>.
Sam Ruby wrote, On 05/05/2003 1.57:
> nicolaken@apache.org wrote:
>
>> nicolaken 2003/05/04 15:55:08
>>
>> Added: python/gump check.py
>> Log:
>> New check.py file.
>> It checks that all the projects referenced are present.
>> In the current gump.xml profile it findes some errors. Run it to
>> see :-)
>
> In the Java version of Gump, it is not an error to have optional
> dependencies on projects that don't exist.
Yup, I have thought about it, and I think that probably it should amount
to an error here. Not a prereq failure, of course, but in "check"
instead it should notify it.
Yup, I will separate the hard deps and the options, only I didn't have
any more energy yesterday night at 1:00 ;-)
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: cvs commit: jakarta-gump/python/gump check.py
Posted by Sam Ruby <ru...@apache.org>.
nicolaken@apache.org wrote:
> nicolaken 2003/05/04 15:55:08
>
> Added: python/gump check.py
> Log:
> New check.py file.
> It checks that all the projects referenced are present.
>
> In the current gump.xml profile it findes some errors. Run it to see :-)
In the Java version of Gump, it is not an error to have optional
dependencies on projects that don't exist.
- Sam Ruby