1 |
commit: 4c4559f45b653a6b816ae66b1a6c4e7dd2ef7e8c |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 14 21:11:22 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 14 21:14:13 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c4559f4 |
7 |
|
8 |
repoman/setup.py: create pym -> lib symlink for unit tests (bug 637460) |
9 |
|
10 |
Various code involving the .repoman_not_installed file assumes |
11 |
that the 'pym' directory should be added to sys.path, therefore |
12 |
create a pym -> lib symlink during unit tests. |
13 |
|
14 |
Bug: https://bugs.gentoo.org/637460 |
15 |
|
16 |
repoman/setup.py | 16 ++++++++++++++++ |
17 |
1 file changed, 16 insertions(+) |
18 |
|
19 |
diff --git a/repoman/setup.py b/repoman/setup.py |
20 |
index 6411231e0..ce0bc493a 100755 |
21 |
--- a/repoman/setup.py |
22 |
+++ b/repoman/setup.py |
23 |
@@ -147,6 +147,11 @@ class x_clean(clean): |
24 |
print('removing %s symlink' % repr(conf_dir)) |
25 |
os.unlink(conf_dir) |
26 |
|
27 |
+ pym_dir = os.path.join(top_dir, 'pym') |
28 |
+ if os.path.islink(pym_dir): |
29 |
+ print('removing %s sylink' % repr(pym_dir)) |
30 |
+ os.unlink(pym_dir) |
31 |
+ |
32 |
pni_file = os.path.join(top_dir, '.repoman_not_installed') |
33 |
if os.path.exists(pni_file): |
34 |
print('removing %s' % repr(pni_file)) |
35 |
@@ -393,6 +398,17 @@ class build_tests(x_build_scripts_custom): |
36 |
print('Symlinking %s -> %s' % (conf_dir, conf_src)) |
37 |
os.symlink(conf_src, conf_dir) |
38 |
|
39 |
+ # symlink 'pym' directory |
40 |
+ pym_dir = os.path.join(self.top_dir, 'pym') |
41 |
+ if os.path.exists(pym_dir): |
42 |
+ if not os.path.islink(pym_dir): |
43 |
+ raise SystemError('%s exists and is not a symlink (collision)' |
44 |
+ % repr(pym_dir)) |
45 |
+ os.unlink(pym_dir) |
46 |
+ pym_src = 'lib' |
47 |
+ print('Symlinking %s -> %s' % (pym_dir, pym_src)) |
48 |
+ os.symlink(pym_src, pym_dir) |
49 |
+ |
50 |
# create $build_lib/../.repoman_not_installed |
51 |
# to enable proper paths in tests |
52 |
with open(os.path.join(self.top_dir, '.repoman_not_installed'), 'w'): |