Skip to content

Commit e692b3f

Browse files
authored
Merge pull request cms-sw#34110 from smuzaffar/use-pfnInPath-DDLSchema
use pfnInPath to find the DDLSchema.xsd
2 parents 7b66901 + 7aa2b15 commit e692b3f

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

Geometry/CMSCommonData/test/run_DOMCount.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#! /usr/bin/env python
22

33
from __future__ import print_function
4+
from FWCore.ParameterSet.pfnInPath import pfnInPath
45
import FWCore.ParameterSet.Config as cms
56
import sys
67
import os
@@ -49,27 +50,7 @@ def callDOMCount(schemaPath, xmlPath):
4950
os.system ("rm %s" % (xmlFilename))
5051

5152
# Find the schema file
52-
schema = os.environ['LOCAL_TOP_DIR'] + '/src/DetectorDescription/Schema/DDLSchema.xsd'
53-
if os.path.isfile(schema):
54-
pass
55-
else:
56-
# It is an error if the file is not there but the package is
57-
packageDirectory = os.environ['LOCAL_TOP_DIR'] + '/src/DetectorDescription/Schema'
58-
if os.path.isdir(packageDirectory):
59-
print('Error, schema file not found')
60-
print('DDLSchema.xsd not found in ' + packageDirectory)
61-
print('Quitting, cannot test XML files without a schema')
62-
sys.exit(0)
63-
64-
# if there is a base release then try to find the file there
65-
schema = os.getenv('CMSSW_RELEASE_BASE') + '/src/DetectorDescription/Schema/DDLSchema.xsd'
66-
if os.path.isfile(schema):
67-
pass
68-
else:
69-
print('Error, schema file not found')
70-
print('DetectorDescription/Schema/DDLSchema.xsd')
71-
print('Quitting, cannot test XML files without a schema')
72-
sys.exit(0)
53+
schema = pfnInPath("DetectorDescription/Schema/DDLSchema.xsd").replace('file:','')
7354
print("schema file is:")
7455
print(schema)
7556
sys.stdout.flush()

0 commit comments

Comments
 (0)