def plugin_loaded(): # Make sure the user's locale can handle non-ASCII. A whole bunch of # work was done to try and make Package Control work even if the locale # was poorly set, by manually encoding all file paths, but it ended up # being a fool's errand since the package loading code built into # Sublime Text is not written to work that way, and although packages # could be installed, they could not be loaded properly. try: os.path.exists(os.path.join(sublime.packages_path(), u"fran\u00e7ais")) except (UnicodeEncodeError): message = text.format( u''' Package Control Your system's locale is set to a value that can not handle non-ASCII characters. Package Control can not properly work unless this is fixed. On Linux, please reference your distribution's docs for information on properly setting the LANG and LC_CTYPE environmental variables. As a temporary work-around, you can launch Sublime Text from the terminal with: LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text ''' ) sublime.error_message(message) return # This handles fixing unicode issues with tempdirs on ST2 for Windows tempfile_unicode_patch() pc_settings = sublime.load_settings(pc_settings_filename()) if not pc_settings.get('bootstrapped'): console_write( u''' Not running package cleanup since bootstrapping is not yet complete ''' ) else: # Start shortly after Sublime starts so package renames don't cause errors # with keybindings, settings, etc disappearing in the middle of parsing sublime.set_timeout(lambda: PackageCleanup().start(), 2000)
def plugin_loaded(): # Make sure the user's locale can handle non-ASCII. A whole bunch of # work was done to try and make Package Control work even if the locale # was poorly set, by manually encoding all file paths, but it ended up # being a fool's errand since the package loading code built into # Sublime Text is not written to work that way, and although packages # could be installed, they could not be loaded properly. try: os.path.exists(os.path.join(sublime.packages_path(), u"fran\u2013ais")) except (UnicodeEncodeError): message = text.format( u''' Package Control Your system's locale is set to a value that can not handle non-ASCII characters. Package Control can not properly work unless this is fixed. On Linux, please reference your distribution's docs for information on properly setting the LANG and LC_CTYPE environmental variables. As a temporary work-around, you can launch Sublime Text from the terminal with: LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text ''' ) sublime.error_message(message) return # This handles fixing unicode issues with tempdirs on ST2 for Windows tempfile_unicode_patch() pc_settings = sublime.load_settings(pc_settings_filename()) if not pc_settings.get('bootstrapped'): console_write( u''' Not running package cleanup since bootstrapping is not yet complete ''' ) else: # Start shortly after Sublime starts so package renames don't cause errors # with keybindings, settings, etc disappearing in the middle of parsing sublime.set_timeout(lambda: PackageCleanup().start(), 2000)
from package_control.unicode import unicode_from_os from package_control.console_write import console_write if sublime.platform() == 'linux': dep_paths = sys_path.generate_dependency_paths(u'ssl-linux') sys_path.add(dep_paths['plat'], first=True) for ssl_ver in [u'1.0.0', u'10', u'0.9.8']: lib_path = os.path.join(dep_paths['arch'], u'libssl-%s' % ssl_ver) try: sys_path.add(lib_path, first=True) import _ssl console_write( u'Linux SSL: successfully loaded _ssl module for libssl.so.%s' % ssl_ver) except (ImportError) as e: console_write(u'Linux SSL: _ssl module import error - %s' % unicode_from_os(e)) sys_path.remove(lib_path) continue try: import ssl except (ImportError) as e: console_write(u'Linux SSL: ssl module import error - %s' % unicode_from_os(e)) sys_path.remove(lib_path)
def plugin_loaded(): # Make sure the user's locale can handle non-ASCII. A whole bunch of # work was done to try and make PackagesManager work even if the locale # was poorly set, by manually encoding all file paths, but it ended up # being a fool's errand since the package loading code built into # Sublime Text is not written to work that way, and although packages # could be installed, they could not be loaded properly. try: os.path.exists(os.path.join(sublime.packages_path(), u"fran\u2013ais")) except (UnicodeEncodeError): message = text.format( u''' PackagesManager Your system's locale is set to a value that can not handle non-ASCII characters. PackagesManager can not properly work unless this is fixed. On Linux, please reference your distribution's docs for information on properly setting the LANG and LC_CTYPE environmental variables. As a temporary work-around, you can launch Sublime Text from the terminal with: LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text ''' ) sublime.error_message(message) return # This handles fixing unicode issues with tempdirs on ST2 for Windows tempfile_unicode_patch() # Ensure we have a Cache dir we can use for temporary data if not os.path.exists(sys_path.pc_cache_dir()): os.makedirs(sys_path.pc_cache_dir(), exist_ok=True) # Clean up the old HTTP cache dir legacy_http_cache = os.path.join(sublime.packages_path(), u'User', u'Package Control.cache') http_cache = os.path.join(sys_path.pc_cache_dir(), 'http_cache') if os.path.exists(legacy_http_cache): if not os.path.exists(http_cache): console_write( u''' Moving HTTP cache data into "Cache/Package Control/http_cache/" ''' ) shutil.move(legacy_http_cache, http_cache) else: console_write( u''' Removing old HTTP cache data" ''' ) shutil.rmtree(legacy_http_cache) # Clean up old CA bundle paths legacy_ca_filenames = [ 'Package Control.system-ca-bundle', 'Package Control.merged-ca-bundle', 'oscrypto-ca-bundle.crt' ] for legacy_ca_filename in legacy_ca_filenames: legacy_ca_path = os.path.join(sublime.packages_path(), 'User', legacy_ca_filename) if os.path.exists(legacy_ca_path): os.unlink(legacy_ca_path) pc_settings = sublime.load_settings(pc_settings_filename()) if not pc_settings.get('bootstrapped'): console_write( u''' Not running package cleanup since bootstrapping is not yet complete ''' ) else: # Start shortly after Sublime starts so package renames don't cause errors # with keybindings, settings, etc disappearing in the middle of parsing sublime.set_timeout(lambda: PackageCleanup().start(), 2000)
from package_control.console_write import console_write if sublime.platform() == "linux": dep_paths = sys_path.generate_dependency_paths(u"ssl-linux") sys_path.add(dep_paths["plat"], first=True) for ssl_ver in [u"1.0.0", u"10", u"0.9.8"]: lib_path = os.path.join(dep_paths["arch"], u"libssl-%s" % ssl_ver) try: sys_path.add(lib_path, first=True) import _ssl console_write(u"Linux SSL: successfully loaded _ssl module for libssl.so.%s" % ssl_ver) except (ImportError) as e: console_write(u"Linux SSL: _ssl module import error - %s" % unicode_from_os(e)) sys_path.remove(lib_path) continue try: import ssl except (ImportError) as e: console_write(u"Linux SSL: ssl module import error - %s" % unicode_from_os(e)) sys_path.remove(lib_path) continue break
from package_control.console_write import console_write if sublime.platform() == 'linux' and int(sublime.version()) < 3109: dep_paths = sys_path.generate_dependency_paths(u'ssl-linux') sys_path.add(dep_paths['plat'], first=True) for ssl_ver in [u'1.0.0', u'10', u'0.9.8']: lib_path = os.path.join(dep_paths['arch'], u'libssl-%s' % ssl_ver) try: sys_path.add(lib_path, first=True) import _ssl console_write(u'Linux SSL: successfully loaded _ssl module for libssl.so.%s' % ssl_ver) except (ImportError) as e: console_write(u'Linux SSL: _ssl module import error - %s' % unicode_from_os(e)) sys_path.remove(lib_path) continue try: import ssl except (ImportError) as e: console_write(u'Linux SSL: ssl module import error - %s' % unicode_from_os(e)) sys_path.remove(lib_path) continue break