python类unsetenv()的实例源码

_environ.py 文件源码 项目:senf 作者: quodlibet 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def unsetenv(key):
    """Like `os.unsetenv` but takes unicode under Windows + Python 2

    Args:
        key (pathlike): The env var to unset
    """

    key = path2fsn(key)
    if is_win:
        # python 3 has no unsetenv under Windows -> use our ctypes one as well
        try:
            del_windows_env_var(key)
        except WindowsError:
            pass
    else:
        os.unsetenv(key)
cheribsd.py 文件源码 项目:cheribuild 作者: CTSRD-CHERI 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def process(self):
        if not IS_FREEBSD:
            if not self.crossbuild:
                statusUpdate("Can't build CHERIBSD on a non-FreeBSD host! Any targets that depend on this will need"
                             " to scp the required files from another server (see --frebsd-build-server options)")
                return
            else:
                self.prepareFreeBSDCrossEnv()
        # remove any environment variables that could interfere with bmake running
        for k, v in os.environ.copy().items():
            if k in ("MAKEFLAGS", "MFLAGS", "MAKELEVEL", "MAKE_TERMERR", "MAKE_TERMOUT"):
                os.unsetenv(k)
                del os.environ[k]
        if self.config.buildenv or self.config.libcheri_buildenv:
            target = "libcheribuildenv" if self.config.libcheri_buildenv else "buildenv"
            args = self.buildworldArgs
            args.remove_flag("-s")  # buildenv should not be silent
            runCmd([self.makeCommand] + args.all_commandline_args + [target], env=args.env_vars,
                   cwd=self.sourceDir)
        else:
            super().process()
pyinstaller?????.py 文件源码 项目:Python_Study 作者: thsheep 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
__init__.py 文件源码 项目:aws-sudo 作者: voytek-solutions 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def proxy_command(command, command_args, credentials):
    # Unset variables for sanity sake
    os.unsetenv('AWS_DEFAULT_PROFILE')
    os.unsetenv('AWS_PROFILE')
    os.unsetenv('AWS_ACCESS_KEY_ID')
    os.unsetenv('AWS_SECRET_ACCESS_KEY')
    os.unsetenv('AWS_SESSION_TOKEN')
    os.unsetenv('AWS_SECURITY_TOKEN')

    # Set AWS/Boto environemnt variables before executing target command
    os.putenv('AWS_ACCESS_KEY_ID', (credentials['AccessKeyId']))
    os.putenv('AWS_SECRET_ACCESS_KEY', (credentials['SecretAccessKey']))
    os.putenv('AWS_SESSION_TOKEN', (credentials['SessionToken']))
    os.putenv('AWS_SECURITY_TOKEN', (credentials['SessionToken']))

    command_status = os.system(command + " " + " ".join(command_args))
    exit(os.WEXITSTATUS(command_status))
ttpassgen.py 文件源码 项目:TTPassGen 作者: tp7309 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
pyi_multiprocess_pool.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
pyi_multiprocess_forking.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            # Last character is stripped in C-loader. We have to add
            # '/' or '\\' at the end.
            os.putenv('_MEIPASS2', sys._MEIPASS + os.sep)
        try:
            super(_Popen, self).__init__(*args, **kw)
        finally:
            if hasattr(sys, 'frozen'):
                # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                # available. In those cases we cannot delete the variable
                # but only set it to the empty string. The bootloader
                # can handle this case.
                if hasattr(os, 'unsetenv'):
                    os.unsetenv('_MEIPASS2')
                else:
                    os.putenv('_MEIPASS2', '')
pancakeViewerApp.py 文件源码 项目:PancakeViewer 作者: forensicmatt 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
pypdfocr_multiprocessing.py 文件源码 项目:cryptoluggage 作者: miguelinux314 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            os.putenv('_MEIPASS2', sys._MEIPASS)
        try:
            super(_Popen, self).__init__(*args, **kw)
        finally:
            if hasattr(sys, 'frozen'):
                # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                # available. In those cases we cannot delete the variable
                # but only set it to the empty string. The bootloader
                # can handle this case.
                if hasattr(os, 'unsetenv'):
                    os.unsetenv('_MEIPASS2')
                else:
                    os.putenv('_MEIPASS2', '')
bb_downloader_func.py 文件源码 项目:unist_bb_downloader 作者: kcm4482 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
MaruCrawler.py 文件源码 项目:MaruCrawler 作者: KiririnLover 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
EventMonkey.py 文件源码 项目:EventMonkey 作者: devgc 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
nrf5_multi_prog.py 文件源码 项目:nRF5-multi-prog 作者: NordicPlayground 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
StashHelper.py 文件源码 项目:stash-scanner 作者: senuido 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
enhance_goodreads_export_gui.py 文件源码 项目:Enhance-GoodReads-Export 作者: PaulKlinger 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            os.putenv('_MEIPASS2', sys._MEIPASS)
        try:
            super(_Popen, self).__init__(*args, **kw)
        finally:
            if hasattr(sys, 'frozen'):
                # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                # available. In those cases we cannot delete the variable
                # but only set it to the empty string. The bootloader
                # can handle this case.
                if hasattr(os, 'unsetenv'):
                    os.unsetenv('_MEIPASS2')
                else:
                    os.putenv('_MEIPASS2', '')


# Second override 'Popen' class with our modified version.
pyi_multiprocess_pool.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
pyi_multiprocess_forking.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            # Last character is stripped in C-loader. We have to add
            # '/' or '\\' at the end.
            os.putenv('_MEIPASS2', sys._MEIPASS + os.sep)
        try:
            super(_Popen, self).__init__(*args, **kw)
        finally:
            if hasattr(sys, 'frozen'):
                # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                # available. In those cases we cannot delete the variable
                # but only set it to the empty string. The bootloader
                # can handle this case.
                if hasattr(os, 'unsetenv'):
                    os.unsetenv('_MEIPASS2')
                else:
                    os.putenv('_MEIPASS2', '')
main.py 文件源码 项目:shadowsocks-pyqt 作者: falseen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version.
edit.py 文件源码 项目:notex 作者: adiultra 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, scr, title="", inittext="", win_location=(0, 0),
                 win_size=(20, 80), box=True, max_paragraphs=0, pw_mode=False,
                 edit=True):
        # Fix for python curses resize bug:
        # http://bugs.python.org/issue2675
        os.unsetenv('LINES')
        os.unsetenv('COLUMNS')
        self.scr = scr
        self.title_orig = title
        if sys.version_info.major < 3:
            enc = locale.getpreferredencoding() or 'utf-8'
            self.title_orig = str(self.title_orig, encoding=enc)
            inittext = str(inittext, encoding=enc)
        self.box = box
        self.max_paragraphs = max_paragraphs
        self.pw_mode = pw_mode
        self.edit = edit
        self.win_location_orig_y, self.win_location_orig_x = win_location
        self.win_size_orig_y, self.win_size_orig_x = win_size
        self.win_size_y = self.win_size_orig_y
        self.win_size_x = self.win_size_orig_x
        self.win_location_y = self.win_location_orig_y
        self.win_location_x = self.win_location_orig_x
        self.win_init()
        self.box_init()
        self.text_init(inittext)
        if self.edit is False:
            self.keys_init_noedit()
            try:
                curses.curs_set(0)
            except _curses.error:
                pass
        else:
            self.keys_init()
            curses.curs_set(1)
        self.display()
execute.py 文件源码 项目:ave 作者: sonyxperiadev 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def t12():
    pretty = '%s t12' % __file__
    print(pretty)

    w = Workspace(uid='vcsjob-execute-t12')
    jobs = make_vcsjob_tree(w)
    os.unsetenv('PATH')

    exc = None
    try:
        vcsjob.execute_tags(jobs, None, ['PATH'])
    except Exception, e:
        exc = e

    if not exc:
        print(
            'FAIL %s: vcsjob.fetch.run() with junk --env did not fail'
            % pretty
        )
        return

    # check the error message
    if not str(exc).startswith('environment variable "PATH" is not set'):
        print('FAIL %s: wrong error message: %s' % (pretty, str(exc)))
        return

    w.delete()

# check that correct value is returned by vcsjob.execute_single()
execute.py 文件源码 项目:ave 作者: sonyxperiadev 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def t12():
    pretty = '%s t12' % __file__
    print(pretty)

    w = Workspace(uid='vcsjob-execute-t12')
    jobs = make_vcsjob_tree(w)
    os.unsetenv('PATH')

    exc = None
    try:
        vcsjob.execute_tags(jobs, None, ['PATH'])
    except Exception, e:
        exc = e

    if not exc:
        print(
            'FAIL %s: vcsjob.fetch.run() with junk --env did not fail'
            % pretty
        )
        return

    # check the error message
    if not str(exc).startswith('environment variable "PATH" is not set'):
        print('FAIL %s: wrong error message: %s' % (pretty, str(exc)))
        return

    w.delete()

# check that correct value is returned by vcsjob.execute_single()
gcp_audit.py 文件源码 项目:gcp-audit 作者: spotify 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def restore_env_credentials():
    if env_credentials:
        os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = env_credentials
    else:
        os.unsetenv('GOOGLE_APPLICATION_CREDENTIALS')
utils.py 文件源码 项目:isar 作者: ilbers 项目源码 文件源码 阅读 503 收藏 0 点赞 0 评论 0
def empty_environment():
    """
    Remove all variables from the environment.
    """
    for s in list(os.environ.keys()):
        os.unsetenv(s)
        del os.environ[s]
compat.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def machine():
    """
    Return machine suffix to use in directory name when looking
    for bootloader.

    PyInstaller is reported to work even on ARM architecture. For that
    case functions system() and architecture() are not enough.
    Path to bootloader has to be composed from system(), architecture()
    and machine() like:
        'Linux-32bit-arm'
    """
    mach = platform.machine()
    if mach.startswith('arm'):
        return 'arm'
    else:
        # Assume x86/x86_64 machine.
        return None


# Set and get environment variables does not handle unicode strings correctly
# on Windows.

# Acting on os.environ instead of using getenv()/setenv()/unsetenv(),
# as suggested in <http://docs.python.org/library/os.html#os.environ>:
# "Calling putenv() directly does not change os.environ, so it's
# better to modify os.environ." (Same for unsetenv.)
compat.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def unsetenv(name):
    """
    Delete the environment variable 'name'.
    """
    # Some platforms (e.g. AIX) do not support `os.unsetenv()` and
    # thus `del os.environ[name]` has no effect onto the real
    # environment. For this case we set the value to the empty string.
    os.environ[name] = ""
    del os.environ[name]


# Exec commands in subprocesses.
etcd_proc.py 文件源码 项目:devenv 作者: dumplingtech 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def start_proc(self, cluster_list, cluster_state):
        os.environ['ETCD_INITIAL_CLUSTER'] = self.build_initial_cluster(cluster_list)

        if cluster_state == 'member':
            subprocess.call(['etcdctl',
                             '--endpoint',
                             self.build_endpoint(cluster_list),
                             'member',
                             'add',
                             self.ip,
                             os.environ['ETCD_INITIAL_ADVERTISE_PEER_URLS']])
            shutil.rmtree(self.DATA_DIR + '/proxy', ignore_errors=True)
            os.environ['ETCD_INITIAL_CLUSTER_STATE'] = 'existing'
            os.unsetenv('ETCD_PROXY')

        elif cluster_state == 'bootstrap':
            shutil.rmtree(self.DATA_DIR + '/member', ignore_errors=True)
            shutil.rmtree(self.DATA_DIR + '/proxy', ignore_errors=True)
            os.environ['ETCD_INITIAL_CLUSTER_STATE'] = 'new'
            os.unsetenv('ETCD_PROXY')

        else:
            shutil.rmtree(self.DATA_DIR + '/member', ignore_errors=True)
            os.unsetenv('ETCD_INITIAL_CLUSTER_STATE')
            os.environ['ETCD_PROXY'] = 'on'

        logging.info("Starting etcd process in %s mode - %s" % (cluster_state, cluster_list))
        self.etcd_proc = subprocess.Popen('/usr/local/bin/etcd')
        self.current_cluster_list = cluster_list
        self.current_cluster_state = cluster_state
etcd_proc.py 文件源码 项目:devenv 作者: dumplingtech 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def start_proc(self, cluster_list, cluster_state):
        os.environ['ETCD_INITIAL_CLUSTER'] = self.build_initial_cluster(cluster_list)

        if cluster_state == 'member':
            subprocess.call(['etcdctl',
                             '--endpoint',
                             self.build_endpoint(cluster_list),
                             'member',
                             'add',
                             self.ip,
                             os.environ['ETCD_INITIAL_ADVERTISE_PEER_URLS']])
            shutil.rmtree(self.DATA_DIR + '/proxy', ignore_errors=True)
            os.environ['ETCD_INITIAL_CLUSTER_STATE'] = 'existing'
            os.unsetenv('ETCD_PROXY')

        elif cluster_state == 'bootstrap':
            shutil.rmtree(self.DATA_DIR + '/member', ignore_errors=True)
            shutil.rmtree(self.DATA_DIR + '/proxy', ignore_errors=True)
            os.environ['ETCD_INITIAL_CLUSTER_STATE'] = 'new'
            os.unsetenv('ETCD_PROXY')

        else:
            shutil.rmtree(self.DATA_DIR + '/member', ignore_errors=True)
            os.unsetenv('ETCD_INITIAL_CLUSTER_STATE')
            os.environ['ETCD_PROXY'] = 'on'

        logging.info("Starting etcd process in %s mode - %s" % (cluster_state, cluster_list))
        self.etcd_proc = subprocess.Popen('/usr/local/bin/etcd')
        self.current_cluster_list = cluster_list
        self.current_cluster_state = cluster_state
test_config.py 文件源码 项目:bubuku 作者: zalando-nakadi 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_zk_prefix_replacement():
    if os.getenv('ZOOKEEPER_PREFIX', None):
        os.unsetenv('ZOOKEEPER_PREFIX')
    assert load_config().zk_prefix == '/'

    os.environ['ZOOKEEPER_PREFIX'] = '/'
    assert load_config().zk_prefix == '/'

    os.environ['ZOOKEEPER_PREFIX'] = 'test'
    assert load_config().zk_prefix == '/test'

    os.environ['ZOOKEEPER_PREFIX'] = '/test'
    assert load_config().zk_prefix == '/test'
test_search.py 文件源码 项目:data-store 作者: HumanCellAtlas 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def tearDownModule():
    ESInfo.server.shutdown()
    IndexSuffix.reset()
    os.unsetenv('DSS_ES_PORT')
test_indexer.py 文件源码 项目:data-store 作者: HumanCellAtlas 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def tearDownModule():
    ESInfo.server.shutdown()
    HTTPInfo.server.shutdown()
    IndexSuffix.reset()
    os.unsetenv('DSS_ES_PORT')


问题


面经


文章

微信
公众号

扫码关注公众号