From a8ef770b88943564f41ce5c69356e64bcfa06029 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jan 20 2025 14:26:18 +0000 Subject: Don't use __file__ in setup.py When setuptools are run from other tooling (e.g. pip install git...), the __file__ would point to different location. Using current directory seems to be safer. --- diff --git a/setup.py b/setup.py index 4d38c08..57c2675 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ #!/usr/bin/env python from __future__ import absolute_import -import os.path from setuptools import setup @@ -24,15 +23,13 @@ def get_install_requires(): def get_version(): - cwd = os.path.dirname(__file__) lcls = {} - exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read(), None, lcls) + exec(open('koji/_version.py', 'rt').read(), None, lcls) return lcls['__version__'] def get_long_description(): - cwd = os.path.dirname(__file__) - return open(os.path.join(cwd, "README.md"), "rt").read() + return open("README.md", "rt").read() setup(