From 600ea3d5c50c1907e5f389d3040644543fae9077 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 18 Sep 2009 03:37:52 +0000 Subject: Centralize resource_spec code. --- repoze/bfg/resource.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'repoze/bfg/resource.py') diff --git a/repoze/bfg/resource.py b/repoze/bfg/resource.py index babbbf84f..2b3101511 100644 --- a/repoze/bfg/resource.py +++ b/repoze/bfg/resource.py @@ -1,3 +1,5 @@ +import os + import pkg_resources from zope.component import queryUtility from zope.interface import implements @@ -167,3 +169,10 @@ class FileOverride: if resource_name == self.path: return self.package, self.prefix +def resource_spec(spec, package_name): + if os.path.isabs(spec): + return spec + if ':' in spec: + return spec + return '%s:%s' % (package_name, spec) + -- cgit v1.2.3