From f3a4705a9ca9e7de13a12fd24f002f8e23b918fa Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 16 Dec 2013 15:57:03 -0500 Subject: [PATCH] Revert "Merge pull request #4874 from leth/editable_install" This reverts commit 15b89b45e1441d4d268b5cc3acca6127b4f38063, reversing changes made to 3d836a1ab72b9b07c9159678cf26ad1e2c8d1aee. --- lib/ansible/constants.py | 14 +++++++------- setup.py | 24 ++++++------------------ 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 290c995272..ea1a23a59b 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -82,13 +82,13 @@ p = load_config_file() active_user = pwd.getpwuid(os.geteuid())[0] -DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/') -EDITABLE_MODULE_PATH = os.path.normpath( - os.path.join(os.path.dirname(__file__), '../../library')) - -if not os.path.exists(DIST_MODULE_PATH) \ - and os.path.exists(EDITABLE_MODULE_PATH): - DIST_MODULE_PATH = EDITABLE_MODULE_PATH +# Needed so the RPM can call setup.py and have modules land in the +# correct location. See #1277 for discussion +if getattr(sys, "real_prefix", None): + # in a virtualenv + DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/') +else: + DIST_MODULE_PATH = '/usr/share/ansible/' # check all of these extensions when looking for yaml files for things like # group variables diff --git a/setup.py b/setup.py index 9012498305..c802eca6fd 100644 --- a/setup.py +++ b/setup.py @@ -4,27 +4,15 @@ import os import sys from glob import glob -def rel(f): - return os.path.join(os.path.dirname(__file__), f) - -sys.path.insert(0, rel('lib')) +sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ from distutils.core import setup -# Needed so the RPM can call setup.py and have modules land in the -# correct location. See #1277 for discussion -if getattr(sys, "real_prefix", None): - # in a virtualenv - DEFAULT_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/library') -else: - DEFAULT_MODULE_PATH = '/usr/share/ansible/library' - -module_path = DEFAULT_MODULE_PATH -if not os.path.exists(DEFAULT_MODULE_PATH): - module_path = rel('library') - +# find library modules +from ansible.constants import DEFAULT_MODULE_PATH +dirs=os.listdir("./library/") data_files = [] -for i in os.listdir(module_path): +for i in dirs: data_files.append((os.path.join(DEFAULT_MODULE_PATH, i), glob('./library/' + i + '/*'))) setup(name='ansible', @@ -35,7 +23,7 @@ setup(name='ansible', url='http://ansibleworks.com/', license='GPLv3', install_requires=['paramiko', 'jinja2', "PyYAML"], - package_dir={ '': 'lib' }, + package_dir={ 'ansible': 'lib/ansible' }, packages=[ 'ansible', 'ansible.utils',