commit:     4c4559f45b653a6b816ae66b1a6c4e7dd2ef7e8c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 14 21:11:22 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 14 21:14:13 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c4559f4

repoman/setup.py: create pym -> lib symlink for unit tests (bug 637460)

Various code involving the .repoman_not_installed file assumes
that the 'pym' directory should be added to sys.path, therefore
create a pym -> lib symlink during unit tests.

Bug: https://bugs.gentoo.org/637460

 repoman/setup.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/repoman/setup.py b/repoman/setup.py
index 6411231e0..ce0bc493a 100755
--- a/repoman/setup.py
+++ b/repoman/setup.py
@@ -147,6 +147,11 @@ class x_clean(clean):
                        print('removing %s symlink' % repr(conf_dir))
                        os.unlink(conf_dir)
 
+               pym_dir = os.path.join(top_dir, 'pym')
+               if os.path.islink(pym_dir):
+                       print('removing %s sylink' % repr(pym_dir))
+                       os.unlink(pym_dir)
+
                pni_file = os.path.join(top_dir, '.repoman_not_installed')
                if os.path.exists(pni_file):
                        print('removing %s' % repr(pni_file))
@@ -393,6 +398,17 @@ class build_tests(x_build_scripts_custom):
                print('Symlinking %s -> %s' % (conf_dir, conf_src))
                os.symlink(conf_src, conf_dir)
 
+               # symlink 'pym' directory
+               pym_dir = os.path.join(self.top_dir, 'pym')
+               if os.path.exists(pym_dir):
+                       if not os.path.islink(pym_dir):
+                               raise SystemError('%s exists and is not a 
symlink (collision)'
+                                       % repr(pym_dir))
+                       os.unlink(pym_dir)
+               pym_src = 'lib'
+               print('Symlinking %s -> %s' % (pym_dir, pym_src))
+               os.symlink(pym_src, pym_dir)
+
                # create $build_lib/../.repoman_not_installed
                # to enable proper paths in tests
                with open(os.path.join(self.top_dir, '.repoman_not_installed'), 
'w'):

Reply via email to