[Zope-Checkins] CVS: Zope3/lib/python/Zope/Misc - package_home.py:1.1.2.1

Jim Fulton jim@zope.com
Sat, 12 Jan 2002 17:35:27 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Misc
In directory cvs.zope.org:/tmp/cvs-serv25057

Added Files:
      Tag: Zope-3x-branch
	package_home.py 
Log Message:
Standard bit of code for getting a package directory from a module
globals.


=== Added File Zope3/lib/python/Zope/Misc/package_home.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""Function for deducing a package file-system location from global data

Revision information: $Id: package_home.py,v 1.1.2.1 2002/01/12 22:35:27 jim Exp $
"""

import os

def package_home(gdict):
    filename = gdict["__file__"]
    return os.path.dirname(filename)