os.path.dirname(__file__) が探しているものかもしれません。モジュール内の __file__ は、モジュールがロードされたパスを返します。
yourmodule が、setup.py 内の Something.py を含むフォルダーであると仮定します。
import os
#setup(...) call here
from yourmodule import Something
print os.path.dirname(Something.__file__)
これに関する唯一の問題は、ファイル構造が setuputils と同じディレクトリに yourmodule を持っている場合です。その場合、python ローダーは優先的に現在のディレクトリから yourmodule.Something をロードします。
どちらかになる可能性があることを覆すための、ややハックだが効果的な2つのオプション
Python パスから現在のディレクトリを削除し、サイト パッケージに現在存在するファイルから強制的にロードします。
import sys sys.path = sys.path[1:]
import ステートメントの直前で yourmodule フォルダーの名前を一時的に変更します。
オプション 1 の場合、全体は次のようになります。
import os
import sys
#setup(...) call here
#Remove first entry in sys.path which is current folder (probably impl dependent, but for practical purposes is consistent)
sys.path = sys.path[1:]
from yourmodule import Something
print os.path.dirname(Something.__file__)
setup.py の 1 つでこれをテストしたところ、うまく機能します。幸運を!