From 106878815f5a5dd61b0e527c502fb6eeaf0c9c67 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 13 Aug 2015 11:29:44 -0400 Subject: [PATCH] build-sys: Avoid self-dependency in setup.py The earlier 58a6e0e4eff379578d497d67002cbef1438f8ab2 and later 455fc8499fee1b970eafd7f80942405ef6bef17f both break if the atomic package is not actually installed on the system - as will be the case with `mock/pbuilder` style builds. It looks like OpenStack uses https://pypi.python.org/pypi/pbr which presumably solves this problem. I however am not super interested right now in diving into that...I just want the thing to build. Ansible just inserts the current dir in `sys.path`, which seems like a simple hack, so let's do that. --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2e0209e1..28d7cd63 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,13 @@ #!/usr/bin/env python # Author: Dan Walsh +import sys +import os from setuptools import setup import pkg_resources -__version__ = pkg_resources.require('Atomic')[0].version +sys.path.insert(0, os.path.abspath(os.getcwd())) +from Atomic import __version__ with open('requirements.txt') as f: requirements = f.read().splitlines()