... | ... |
@@ -82,13 +82,13 @@ p = load_config_file() |
82 | 82 |
|
83 | 83 |
active_user = pwd.getpwuid(os.geteuid())[0] |
84 | 84 |
|
85 |
-# Needed so the RPM can call setup.py and have modules land in the |
|
86 |
-# correct location. See #1277 for discussion |
|
87 |
-if getattr(sys, "real_prefix", None): |
|
88 |
- # in a virtualenv |
|
89 |
- DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/') |
|
90 |
-else: |
|
91 |
- DIST_MODULE_PATH = '/usr/share/ansible/' |
|
85 |
+DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/') |
|
86 |
+EDITABLE_MODULE_PATH = os.path.normpath( |
|
87 |
+ os.path.join(os.path.dirname(__file__), '../../library')) |
|
88 |
+ |
|
89 |
+if not os.path.exists(DIST_MODULE_PATH) \ |
|
90 |
+ and os.path.exists(EDITABLE_MODULE_PATH): |
|
91 |
+ DIST_MODULE_PATH = EDITABLE_MODULE_PATH |
|
92 | 92 |
|
93 | 93 |
# sections in config file |
94 | 94 |
DEFAULTS='defaults' |
... | ... |
@@ -4,15 +4,27 @@ import os |
4 | 4 |
import sys |
5 | 5 |
from glob import glob |
6 | 6 |
|
7 |
-sys.path.insert(0, os.path.abspath('lib')) |
|
7 |
+def rel(f): |
|
8 |
+ return os.path.join(os.path.dirname(__file__), f) |
|
9 |
+ |
|
10 |
+sys.path.insert(0, rel('lib')) |
|
8 | 11 |
from ansible import __version__, __author__ |
9 | 12 |
from distutils.core import setup |
10 | 13 |
|
11 |
-# find library modules |
|
12 |
-from ansible.constants import DEFAULT_MODULE_PATH |
|
13 |
-dirs=os.listdir("./library/") |
|
14 |
+# Needed so the RPM can call setup.py and have modules land in the |
|
15 |
+# correct location. See #1277 for discussion |
|
16 |
+if getattr(sys, "real_prefix", None): |
|
17 |
+ # in a virtualenv |
|
18 |
+ DEFAULT_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/library') |
|
19 |
+else: |
|
20 |
+ DEFAULT_MODULE_PATH = '/usr/share/ansible/library' |
|
21 |
+ |
|
22 |
+module_path = DEFAULT_MODULE_PATH |
|
23 |
+if not os.path.exists(DEFAULT_MODULE_PATH): |
|
24 |
+ module_path = rel('library') |
|
25 |
+ |
|
14 | 26 |
data_files = [] |
15 |
-for i in dirs: |
|
27 |
+for i in os.listdir(module_path): |
|
16 | 28 |
data_files.append((os.path.join(DEFAULT_MODULE_PATH, i), glob('./library/' + i + '/*'))) |
17 | 29 |
|
18 | 30 |
setup(name='ansible', |
... | ... |
@@ -23,7 +35,7 @@ setup(name='ansible', |
23 | 23 |
url='http://ansibleworks.com/', |
24 | 24 |
license='GPLv3', |
25 | 25 |
install_requires=['paramiko', 'jinja2', "PyYAML"], |
26 |
- package_dir={ 'ansible': 'lib/ansible' }, |
|
26 |
+ package_dir={ '': 'lib' }, |
|
27 | 27 |
packages=[ |
28 | 28 |
'ansible', |
29 | 29 |
'ansible.utils', |