Python site.ENABLE_USER_SITE Examples
The following are 30
code examples of site.ENABLE_USER_SITE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
site
, or try the search function
.
Example #1
Source File: compat.py From hupper with MIT License | 7 votes |
def get_site_packages(): # pragma: no cover try: paths = site.getsitepackages() if site.ENABLE_USER_SITE: paths.append(site.getusersitepackages()) return paths # virtualenv does not ship with a getsitepackages impl so we fallback # to using distutils if we can # https://github.com/pypa/virtualenv/issues/355 except Exception: try: from distutils.sysconfig import get_python_lib return [get_python_lib()] # just incase, don't fail here, it's not worth it except Exception: return [] ################################################ # cross-compatible metaclass implementation # Copyright (c) 2010-2012 Benjamin Peterson
Example #2
Source File: common.py From thonny with MIT License | 6 votes |
def get_exe_dirs(): result = [] if site.ENABLE_USER_SITE: if platform.system() == "Windows": if site.getusersitepackages(): result.append(site.getusersitepackages().replace("site-packages", "Scripts")) else: if site.getuserbase(): result.append(site.getuserbase() + "/bin") main_scripts = os.path.join(sys.prefix, "Scripts") if os.path.isdir(main_scripts) and main_scripts not in result: result.append(main_scripts) if os.path.dirname(sys.executable) not in result: result.append(os.path.dirname(sys.executable)) return result
Example #3
Source File: test_site.py From ironpython2 with Apache License 2.0 | 6 votes |
def setUpModule(): global OLD_SYS_PATH OLD_SYS_PATH = sys.path[:] if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE): # need to add user site directory for tests try: os.makedirs(site.USER_SITE) # modify sys.path: will be restored by tearDownModule() site.addsitedir(site.USER_SITE) except OSError as exc: if exc.errno in (errno.EACCES, errno.EPERM): raise unittest.SkipTest('unable to create user site directory (%r): %s' % (site.USER_SITE, exc)) else: raise
Example #4
Source File: test_easy_install.py From oss-ftp with MIT License | 6 votes |
def setUp(self): self.dir = tempfile.mkdtemp() setup = os.path.join(self.dir, 'setup.py') f = open(setup, 'w') f.write(SETUP_PY) f.close() self.old_cwd = os.getcwd() os.chdir(self.dir) self.old_enable_site = site.ENABLE_USER_SITE self.old_file = easy_install_pkg.__file__ self.old_base = site.USER_BASE site.USER_BASE = tempfile.mkdtemp() self.old_site = site.USER_SITE site.USER_SITE = tempfile.mkdtemp() easy_install_pkg.__file__ = site.USER_SITE
Example #5
Source File: test_easy_install.py From pledgeservice with Apache License 2.0 | 6 votes |
def setUp(self): self.dir = tempfile.mkdtemp() setup = os.path.join(self.dir, 'setup.py') f = open(setup, 'w') f.write(SETUP_PY) f.close() self.old_cwd = os.getcwd() os.chdir(self.dir) self.old_enable_site = site.ENABLE_USER_SITE self.old_file = easy_install_pkg.__file__ self.old_base = site.USER_BASE site.USER_BASE = tempfile.mkdtemp() self.old_site = site.USER_SITE site.USER_SITE = tempfile.mkdtemp() easy_install_pkg.__file__ = site.USER_SITE
Example #6
Source File: test_easy_install.py From oss-ftp with MIT License | 5 votes |
def test_user_install_not_implied_without_usersite_enabled(self): site.ENABLE_USER_SITE = False # usually enabled #XXX: replace with something meaningfull dist = Distribution() dist.script_name = 'setup.py' cmd = easy_install(dist) cmd.args = ['py'] cmd.initialize_options() self.assertFalse(cmd.user, 'NOT user should be implied')
Example #7
Source File: easy_install.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #8
Source File: easy_install.py From python-netsurv with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #9
Source File: test_easy_install.py From pledgeservice with Apache License 2.0 | 5 votes |
def tearDown(self): os.chdir(self.old_cwd) shutil.rmtree(self.dir) shutil.rmtree(site.USER_BASE) shutil.rmtree(site.USER_SITE) site.USER_BASE = self.old_base site.USER_SITE = self.old_site site.ENABLE_USER_SITE = self.old_enable_site easy_install_pkg.__file__ = self.old_file
Example #10
Source File: easy_install.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #11
Source File: easy_install.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #12
Source File: easy_install.py From pex with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #13
Source File: easy_install.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #14
Source File: easy_install.py From deepWordBug with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #15
Source File: easy_install.py From ironpython2 with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #16
Source File: easy_install.py From scylla with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #17
Source File: easy_install.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #18
Source File: easy_install.py From stopstalk-deployment with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #19
Source File: easy_install.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #20
Source File: easy_install.py From Flask-P2P with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #21
Source File: easy_install.py From planespotter with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #22
Source File: easy_install.py From rules_pip with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #23
Source File: easy_install.py From ImageFusion with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #24
Source File: easy_install.py From Ansible with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #25
Source File: easy_install.py From datafari with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #26
Source File: contexts.py From setuptools with MIT License | 5 votes |
def save_user_site_setting(): saved = site.ENABLE_USER_SITE try: yield saved finally: site.ENABLE_USER_SITE = saved
Example #27
Source File: easy_install.py From setuptools with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #28
Source File: easy_install.py From PhonePi_SampleServer with MIT License | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)
Example #29
Source File: test_site.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def setUpModule(): global OLD_SYS_PATH OLD_SYS_PATH = sys.path[:] if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE): # need to add user site directory for tests try: os.makedirs(site.USER_SITE) # modify sys.path: will be restored by tearDownModule() site.addsitedir(site.USER_SITE) except PermissionError as exc: raise unittest.SkipTest('unable to create user site directory (%r): %s' % (site.USER_SITE, exc))
Example #30
Source File: easy_install.py From syntheticmass with Apache License 2.0 | 5 votes |
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified" raise DistutilsPlatformError(msg) self.install_base = self.install_platbase = self.install_userbase scheme_name = os.name.replace('posix', 'unix') + '_user' self.select_scheme(scheme_name)