Python platform.python_implementation() Examples
The following are 30
code examples of platform.python_implementation().
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
platform
, or try the search function
.
Example #1
Source File: test_functional.py From python-netsurv with MIT License | 6 votes |
def setUp(self): if self._should_be_skipped_due_to_version(): pytest.skip( 'Test cannot run with Python %s.' % (sys.version.split(' ')[0],)) missing = [] for req in self._test_file.options['requires']: try: __import__(req) except ImportError: missing.append(req) if missing: pytest.skip('Requires %s to be present.' % (','.join(missing),)) if self._test_file.options['except_implementations']: implementations = [ item.strip() for item in self._test_file.options['except_implementations'].split(",") ] implementation = platform.python_implementation() if implementation in implementations: pytest.skip( 'Test cannot run with Python implementation %r' % (implementation, ))
Example #2
Source File: setup.py From pulse2percept with BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('models', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') if platform.python_implementation() != 'PyPy': config.add_extension('_beyeler2019', sources=['_beyeler2019.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_extension('_horsager2009', sources=['_horsager2009.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_extension('_nanduri2012', sources=['_nanduri2012.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage("tests") return config
Example #3
Source File: iostream_test.py From tornado-zh with MIT License | 6 votes |
def test_large_read_until(self): # Performance test: read_until used to have a quadratic component # so a read_until of 4MB would take 8 seconds; now it takes 0.25 # seconds. server, client = self.make_iostream_pair() try: # This test fails on pypy with ssl. I think it's because # pypy's gc defeats moves objects, breaking the # "frozen write buffer" assumption. if (isinstance(server, SSLIOStream) and platform.python_implementation() == 'PyPy'): raise unittest.SkipTest( "pypy gc causes problems with openssl") NUM_KB = 4096 for i in range(NUM_KB): client.write(b"A" * 1024) client.write(b"\r\n") server.read_until(b"\r\n", self.stop) data = self.wait() self.assertEqual(len(data), NUM_KB * 1024 + 2) finally: server.close() client.close()
Example #4
Source File: setup.py From pulse2percept with BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('stimuli', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') if platform.python_implementation() != 'PyPy': config.add_extension('_base', sources=['_base.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage('tests') config.add_data_dir('data') return config
Example #5
Source File: cache.py From recruit with Apache License 2.0 | 6 votes |
def __init__(self, default_timeout=300, cache=""): BaseCache.__init__(self, default_timeout) if platform.python_implementation() == "PyPy": raise RuntimeError( "uWSGI caching does not work under PyPy, see " "the docs for more details." ) try: import uwsgi self._uwsgi = uwsgi except ImportError: raise RuntimeError( "uWSGI could not be imported, are you running under uWSGI?" ) self.cache = cache
Example #6
Source File: markers.py From recruit with Apache License 2.0 | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #7
Source File: cli.py From stdpopsim with GNU General Public License v3.0 | 6 votes |
def get_environment(): """ Returns a dictionary describing the environment in which stdpopsim is currently running. """ env = { "os": { "system": platform.system(), "node": platform.node(), "release": platform.release(), "version": platform.version(), "machine": platform.machine(), }, "python": { "implementation": platform.python_implementation(), "version": platform.python_version(), }, "libraries": { "msprime": {"version": msprime.__version__}, "tskit": {"version": tskit.__version__}, } } return env
Example #8
Source File: markers.py From jbox with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #9
Source File: markers.py From jbox with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #10
Source File: install.py From jbox with MIT License | 6 votes |
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run_command', but it won't have been called by 'run_commands'. Return True in that case or if a call stack is unavailable. Return False otherwise. """ if run_frame is None: msg = "Call stack not available. bdist_* commands may fail." warnings.warn(msg) if platform.python_implementation() == 'IronPython': msg = "For best results, pass -X:Frames to enable call stack." warnings.warn(msg) return True res = inspect.getouterframes(run_frame)[2] caller, = res[:1] info = inspect.getframeinfo(caller) caller_module = caller.f_globals.get('__name__', '') return ( caller_module == 'distutils.dist' and info.function == 'run_commands' )
Example #11
Source File: provenance.py From tsinfer with GNU General Public License v3.0 | 6 votes |
def get_environment(): """ Returns a dictionary describing the environment in which tsinfer is currently running. """ env = { "libraries": { "zarr": {"version": zarr.__version__}, "numcodecs": {"version": numcodecs.__version__}, "lmdb": {"version": lmdb.__version__}, "tskit": {"version": tskit.__version__}, }, "os": { "system": platform.system(), "node": platform.node(), "release": platform.release(), "version": platform.version(), "machine": platform.machine(), }, "python": { "implementation": platform.python_implementation(), "version": platform.python_version_tuple(), }, } return env
Example #12
Source File: __init__.py From aegea with Apache License 2.0 | 6 votes |
def initialize(): global config, parser from .util.printing import BOLD, RED, ENDC config = AegeaConfig(__name__, use_yaml=True, save_on_exit=False) if not os.path.exists(config.config_files[2]): config_dir = os.path.dirname(os.path.abspath(config.config_files[2])) try: os.makedirs(config_dir) except OSError as e: if not (e.errno == errno.EEXIST and os.path.isdir(config_dir)): raise shutil.copy(os.path.join(os.path.dirname(__file__), "user_config.yml"), config.config_files[2]) logger.info("Wrote new config file %s with default values", config.config_files[2]) config = AegeaConfig(__name__, use_yaml=True, save_on_exit=False) parser = argparse.ArgumentParser( description="{}: {}".format(BOLD() + RED() + __name__.capitalize() + ENDC(), fill(__doc__.strip())), formatter_class=AegeaHelpFormatter ) parser.add_argument("--version", action="version", version="%(prog)s {}\n{} {}\n{}".format( __version__, platform.python_implementation(), platform.python_version(), platform.platform() )) def help(args): parser.print_help() register_parser(help)
Example #13
Source File: channel0.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _client_properties(): """AMQPStorm Client Properties. :rtype: dict """ return { 'product': 'AMQPStorm', 'platform': 'Python %s (%s)' % (platform.python_version(), platform.python_implementation()), 'capabilities': { 'basic.nack': True, 'connection.blocked': True, 'publisher_confirms': True, 'consumer_cancel_notify': True, 'authentication_failure_close': True, }, 'information': 'See https://github.com/eandersson/amqpstorm', 'version': __version__ }
Example #14
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #15
Source File: install.py From python-netsurv with MIT License | 6 votes |
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run_command', but it won't have been called by 'run_commands'. Return True in that case or if a call stack is unavailable. Return False otherwise. """ if run_frame is None: msg = "Call stack not available. bdist_* commands may fail." warnings.warn(msg) if platform.python_implementation() == 'IronPython': msg = "For best results, pass -X:Frames to enable call stack." warnings.warn(msg) return True res = inspect.getouterframes(run_frame)[2] caller, = res[:1] info = inspect.getframeinfo(caller) caller_module = caller.f_globals.get('__name__', '') return ( caller_module == 'distutils.dist' and info.function == 'run_commands' )
Example #16
Source File: system.py From stem with GNU Lesser General Public License v3.0 | 6 votes |
def test_set_process_name(self): """ Exercises the get_process_name() and set_process_name() methods. """ if platform.python_implementation() == 'PyPy': self.skipTest('(unimplemented for pypy)') initial_name = stem.util.system.get_process_name() self.assertTrue('run_tests.py' in initial_name) try: stem.util.system.set_process_name('stem_integ') self.assertEqual('stem_integ', stem.util.system.get_process_name()) finally: stem.util.system.set_process_name(initial_name)
Example #17
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, "implementation"): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = "0" implementation_name = "" return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #18
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #19
Source File: test_functional.py From python-netsurv with MIT License | 6 votes |
def setUp(self): if self._should_be_skipped_due_to_version(): pytest.skip( 'Test cannot run with Python %s.' % (sys.version.split(' ')[0],)) missing = [] for req in self._test_file.options['requires']: try: __import__(req) except ImportError: missing.append(req) if missing: pytest.skip('Requires %s to be present.' % (','.join(missing),)) if self._test_file.options['except_implementations']: implementations = [ item.strip() for item in self._test_file.options['except_implementations'].split(",") ] implementation = platform.python_implementation() if implementation in implementations: pytest.skip( 'Test cannot run with Python implementation %r' % (implementation, ))
Example #20
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, "implementation"): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = "0" implementation_name = "" return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #21
Source File: utils.py From py2deb with MIT License | 6 votes |
def python_version(): """ Find the version of Python we're running. This specifically returns a name that matches both of the following: - The name of the Debian package providing the current Python version. - The name of the interpreter executable for the current Python version. :returns: A string like ``python2.7``, ``python3.7`` or ``pypy``. """ python_version = ( 'pypy' if platform.python_implementation() == 'PyPy' else 'python%d.%d' % sys.version_info[:2] ) logger.debug("Detected Python version: %s", python_version) return python_version
Example #22
Source File: install.py From pledgeservice with Apache License 2.0 | 6 votes |
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run_command', but it won't have been called by 'run_commands'. Return True in that case or if a call stack is unavailable. Return False otherwise. """ if run_frame is None: msg = "Call stack not available. bdist_* commands may fail." warnings.warn(msg) if platform.python_implementation() == 'IronPython': msg = "For best results, pass -X:Frames to enable call stack." warnings.warn(msg) return True res = inspect.getouterframes(run_frame)[2] caller, = res[:1] info = inspect.getframeinfo(caller) caller_module = caller.f_globals.get('__name__', '') return ( caller_module == 'distutils.dist' and info.function == 'run_commands' )
Example #23
Source File: markers.py From lambda-packs with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #24
Source File: markers.py From lambda-packs with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #25
Source File: install.py From lambda-packs with MIT License | 6 votes |
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run_command', but it won't have been called by 'run_commands'. Return True in that case or if a call stack is unavailable. Return False otherwise. """ if run_frame is None: msg = "Call stack not available. bdist_* commands may fail." warnings.warn(msg) if platform.python_implementation() == 'IronPython': msg = "For best results, pass -X:Frames to enable call stack." warnings.warn(msg) return True res = inspect.getouterframes(run_frame)[2] caller, = res[:1] info = inspect.getframeinfo(caller) caller_module = caller.f_globals.get('__name__', '') return ( caller_module == 'distutils.dist' and info.function == 'run_commands' )
Example #26
Source File: env.py From poetry with MIT License | 6 votes |
def __init__( self, version_info=(3, 7, 0), python_implementation="CPython", platform="darwin", os_name="posix", is_venv=False, pip_version="19.1", sys_path=None, config_vars=None, **kwargs ): super(MockEnv, self).__init__(**kwargs) self._version_info = version_info self._python_implementation = python_implementation self._platform = platform self._os_name = os_name self._is_venv = is_venv self._pip_version = Version.parse(pip_version) self._sys_path = sys_path self._config_vars = config_vars
Example #27
Source File: prints.py From pyinfra with MIT License | 6 votes |
def print_support_info(): click.echo(''' If you are having issues with pyinfra or wish to make feature requests, please check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues . When adding an issue, be sure to include the following: ''') click.echo(' System: {0}'.format(platform.system())) click.echo(' Platform: {0}'.format(platform.platform())) click.echo(' Release: {0}'.format(platform.uname()[2])) click.echo(' Machine: {0}'.format(platform.uname()[4])) click.echo(' pyinfra: v{0}'.format(__version__)) click.echo(' Executable: {0}'.format(sys.argv[0])) click.echo(' Python: {0} ({1}, {2})'.format( platform.python_version(), platform.python_implementation(), platform.python_compiler(), ))
Example #28
Source File: markers.py From ironpython2 with Apache License 2.0 | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #29
Source File: markers.py From ironpython2 with Apache License 2.0 | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #30
Source File: install.py From ironpython2 with Apache License 2.0 | 6 votes |
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might* be 'run_command', but it won't have been called by 'run_commands'. Return True in that case or if a call stack is unavailable. Return False otherwise. """ if run_frame is None: msg = "Call stack not available. bdist_* commands may fail." warnings.warn(msg) if platform.python_implementation() == 'IronPython': msg = "For best results, pass -X:Frames to enable call stack." warnings.warn(msg) return True res = inspect.getouterframes(run_frame)[2] caller, = res[:1] info = inspect.getframeinfo(caller) caller_module = caller.f_globals.get('__name__', '') return ( caller_module == 'distutils.dist' and info.function == 'run_commands' )