Commit Graph

65 Commits

Author SHA1 Message Date
Victor Stinner 8f4ef3b019
Remove unused imports in tests (GH-14518) 2019-07-01 18:28:25 +02:00
Steve Dower 9048c49322
bpo-37369: Fix initialization of sys members when launched via an app container (GH-14428)
sys._base_executable is now always defined on all platforms, and can be overridden through configuration.
Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
2019-06-29 10:34:11 -07:00
Victor Stinner 3a521f0b61
bpo-35346, platform: replace os.popen() with subprocess (GH-10786)
Replace os.popen() with subprocess.check_output() in the platform module:

* platform.uname() (its _syscmd_ver() helper function) now redirects
  stderr to DEVNULL.
* Remove platform.DEV_NULL.
* _syscmd_uname() and _syscmd_file() no longer catch AttributeError.
  The "except AttributeError:" was only needed in Python 2, when
  os.popen() was not always available. In Python 3,
  subprocess.check_output() is always available.
2018-12-07 11:10:33 +01:00
Victor Stinner ea0ca218b0
bpo-35344: platform.platform() uses mac_ver() on macOS (GH-10780)
On macOS, platform.platform() now uses mac_ver(), if it returns a
non-empty release string, to get the macOS version rather than darwin
version.
2018-12-05 22:41:52 +01:00
Victor Stinner 476b113ed8
bpo-35389: platform.libc_ver() uses os.confstr() (GH-10891)
platform.libc_ver() now uses os.confstr('CS_GNU_LIBC_VERSION') if
available and the *executable* parameter is not set. The default
value of the libc_ver() *executable* parameter becomes None.

Quick benchmark on Fedora 29:

python3 -m perf command ./python -S -c 'import platform; platform.libc_ver()'
94.9 ms +- 4.3 ms -> 33.2 ms +- 1.4 ms: 2.86x faster (-65%)
2018-12-05 14:04:52 +01:00
Victor Stinner 73104fa1e6
bpo-35345: Remove platform.popen() (GH-10781)
Remove platform.popen() function, it was deprecated since Python 3.3:
use os.popen() instead.

Rename also the "Removed" section to "API and Feature Removals"
of What's New in Python 3.8.
2018-11-29 09:58:20 +01:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) 90d0cfb222 bpo-35202: Remove unused imports in tests. (GH-10561) 2018-11-16 17:32:58 +02:00
Steve Dower f14c28f397
bpo-34011: Fixes missing venv files and other tests (GH-9458) 2018-09-20 13:38:34 -07:00
Serhiy Storchaka 7917aadb3e
bpo-26544: Add test for platform._comparable_version(). (GH-8973) 2018-09-04 15:04:25 +03:00
Serhiy Storchaka 2a9b8babf0
bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684) 2018-07-09 11:47:45 +03:00
Victor Stinner 937ee9e745
Revert "bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)" (GH-7919)
This reverts commit 8fbbdf0c31.
2018-06-26 02:11:06 +02:00
Victor Stinner 8fbbdf0c31
bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)
* Add support.MS_WINDOWS: True if Python is running on Microsoft Windows.
* Add support.MACOS: True if Python is running on Apple macOS.
* Replace support.is_android with support.ANDROID
* Replace support.is_jython with support.JYTHON
* Cleanup code to initialize unix_shell
2018-06-22 19:25:44 +02:00
Petr Viktorin 8b94b41ab7
bpo-28167: Remove platform.linux_distribution (GH-6871)
* test_ssl: Remove skip_if_broken_ubuntu_ssl

We no longer support OpenSSL 0.9.8.15.15.

* bpo-28167: Remove platform.linux_distribution
2018-05-16 11:51:18 -04:00
Matthias Bussonnier 9eb40bc38d bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6669)
Also bump PendingDeprecationWarning to DeprecationWarning.
2018-05-15 11:17:00 -04:00
Victor Stinner fe2d5babba
bpo-32159: Remove tools for CVS and Subversion (#4615)
CPython migrated from CVS to Subversion, to Mercurial, and then to
Git. CVS and Subversion are not more used to develop CPython.

* platform module: drop support for sys.subversion. The
  sys.subversion attribute has been removed in Python 3.3.
* Remove Misc/svnmap.txt
* Remove Tools/scripts/svneol.py
* Remove Tools/scripts/treesync.py
2017-11-28 22:29:32 +01:00
Ned Deily 5c4b0d063a bpo-27593: Get SCM build info from git instead of hg. (#446)
sys.version and the platform module python_build(),
python_branch(), and python_revision() functions now use
git information rather than hg when building from a repo.

Based on original patches by Brett Cannon and Steve Dower.
2017-03-04 00:19:55 -05:00
Steve Dower c5111b5b1f Closes #28059: Fixes test_platform to set PYTHONPATH for .pyd files 2016-09-10 12:25:07 -07:00
Steve Dower 109bc3aa73 Closes #28059: Fixes test_platform to set PYTHONPATH for .pyd files 2016-09-10 12:19:42 -07:00
Victor Stinner 0fc55a234f test_platform: Save/restore os.environ on Windows 2016-09-10 06:24:47 -04:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Martin Panter 4e50553823 Issue #21313: Tolerate truncated buildinfo in sys.version 2016-06-08 06:12:22 +00:00
Berker Peksag 8d8221f0d6 Issue #26041: Remove "will be removed in Python 3.7" from description messages
We will keep platform.dist() and platform.linux_distribution() to make porting
from Python 2 easier.

Patch by Kumaripaba Miyurusara Athukorala.
2016-04-24 03:32:24 +03:00
Berker Peksag 9e7990ae21 Issue #24210: Silence more PendingDeprecationWarning warnings in tests. 2015-05-16 23:21:26 +03:00
Berker Peksag 2f3742b0d8 Issue #1322: platform.dist() and platform.linux_distribution() functions are now deprecated.
Initial patch by Vajrasky Kok.
2015-05-13 12:32:20 +03:00
Barry Warsaw 7c549c4e64 - Issue #21539: Add a *exists_ok* argument to `Pathlib.mkdir()` to mimic
`mkdir -p` and `os.makedirs()` functionality.  When true, ignore
  FileExistsErrors.  Patch by Berker Peksag.

(With minor cleanups, additional tests, doc tweaks, etc. by Barry)

Also:

* Remove some unused imports in test_pathlib.py reported by pyflakes.
2014-08-05 11:28:12 -04:00
Victor Stinner 271493b68c Issue #17429: Oops, remove unused import 2013-12-09 00:25:57 +01:00
Victor Stinner 620c48b7ea Issue #17429: platform.linux_distribution() now decodes files from the UTF-8
encoding with the surrogateescape error handler, instead of decoding from the
locale encoding in strict mode. It fixes the function on Fedora 19 which is
probably the first major distribution release with a non-ASCII name. Patch
written by Toshio Kuratomi.
2013-12-09 00:01:27 +01:00
Ezio Melotti f076f53386 #8964: fix platform._sys_version to handle IronPython 2.6+. 2013-10-21 03:03:32 +03:00
Larry Hastings 68386bc0b8 Issue #15164: Change return value of platform.uname() from a
plain tuple to a collections.namedtuple.
2012-06-24 14:30:41 -07:00
Ned Deily 07b353716c Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
as the processor type on some Mac systems.
2011-07-13 15:09:49 -07:00
Ned Deily 58e3350bd4 Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
as the processor type on some Mac systems.  Also fix NameError in fallback
_mac_ver_gestalt function.  And remove out-of-date URL in docs.
2011-07-13 15:07:04 -07:00
Victor Stinner 3a38a6db43 test_platform: ignore DeprecationWarning on popen() test 2011-06-10 13:59:59 +02:00
Georg Brandl 776e586114 Remove sys.subversion and svn build identification leftovers. 2011-03-06 10:35:42 +01:00
Georg Brandl fe09a54280 Merge build identification to default branch. 2011-03-06 10:26:32 +01:00
Georg Brandl 13039c87f1 Merge build identification to 3.2 branch. 2011-03-06 10:13:00 +01:00
Georg Brandl 8256242b30 Adapt platform and test_platform to the build identification changes. 2011-03-05 21:09:22 +01:00
Victor Stinner ff45fedf61 Issue #11377: Fix quoting on Windows in test_platform 2011-03-03 14:07:21 +00:00
Victor Stinner 1dfd380306 Issue #11377: Deprecate platform.popen() and reimplement it with os.popen(). 2011-03-03 12:54:07 +00:00
Brian Curtin 3b4499c5c7 Fix #9333. The symlink function is always available now, raising OSError
when the user doesn't hold the symbolic link privilege rather than hiding it.
2010-12-28 14:31:47 +00:00
Brian Curtin 52173d4959 Fix #9333. Expose os.symlink on Windows only when usable.
In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege
is an account privilege that is required to be held by the user. Not only
must the privilege be enabled for the account, the activated privileges for
the currently running application must be adjusted to enable the requested
privilege.

Rather than exposing an additional function to be called prior to the user's
first os.symlink call, we handle the AdjustTokenPrivileges Windows API call
internally and only expose os.symlink when the privilege escalation was
successful.

Due to the change of only exposing os.symlink when it's available, we can
go back to the original test skipping methods of checking via `hasattr`.
2010-12-02 18:29:18 +00:00
Ezio Melotti 19f2aeba67 Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line

  #9424: Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 01:30:29 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Ronald Oussoren 7180d48781 Merged revisions 83075 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83075 | ronald.oussoren | 2010-07-23 12:54:59 +0100 (Fri, 23 Jul 2010) | 5 lines

  Fix for issue 7895. Avoid crashing the interpreter
  when calling platform.mac_ver after calling os.fork by
  reading from a system configuration file instead of
  using OSX APIs.
........
2010-07-23 12:36:59 +00:00
Ronald Oussoren e186e384f4 Fix for issue 7895. Avoid crashing the interpreter
when calling platform.mac_ver after calling os.fork by
reading from a system configuration file instead of
using OSX APIs.
2010-07-23 11:54:59 +00:00
Brian Curtin 74e4561a3c Re-flow several long lines from #1578269. 2010-07-09 15:58:59 +00:00
Brian Curtin d40e6f70a5 Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater,
aka Vista. Previous Windows versions will raise NotImplementedError
when trying to symlink.

Includes numerous test updates and additions to test_os, including
a symlink_support module because of the fact that privilege escalation
is required in order to run the tests to ensure that the user is able
to create symlinks. By default, accounts do not have the required
privilege, so the escalation code will have to be exposed later (or
documented on how to do so). I'll be following up with that work next.

Note that the tests use ctypes, which was agreed on during the PyCon
language summit.
2010-07-08 21:39:08 +00:00
R. David Murray a1135543dd Fix porting mistake in r79298. 2010-03-24 00:29:21 +00:00
R. David Murray ca2edce676 Merged revisions 79294 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79294 | r.david.murray | 2010-03-22 11:55:09 -0400 (Mon, 22 Mar 2010) | 4 lines

  Issue #7860: platform.uname now reports the correct 'machine' type
  when Python is running in WOW64 mode on 64 bit Windows.  Patch by
  Brian Curtin.
........
2010-03-22 17:48:48 +00:00
Georg Brandl 89fad14944 Merged revisions 78018,78035-78040,78042-78043,78046,78048-78052,78054,78059,78075-78080 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78018 | georg.brandl | 2010-02-06 11:08:21 +0100 (Sa, 06 Feb 2010) | 1 line

  #7864: make deprecation notices a bit clearer.
........
  r78035 | georg.brandl | 2010-02-06 23:44:17 +0100 (Sa, 06 Feb 2010) | 1 line

  Fix duplicate import.
........
  r78036 | georg.brandl | 2010-02-06 23:49:47 +0100 (Sa, 06 Feb 2010) | 1 line

  Remove unused import.
........
  r78037 | georg.brandl | 2010-02-06 23:59:15 +0100 (Sa, 06 Feb 2010) | 1 line

  No need to assign the results of expressions used only for side effects.
........
  r78038 | georg.brandl | 2010-02-07 00:02:29 +0100 (So, 07 Feb 2010) | 1 line

  Add a missing import.
........
  r78039 | georg.brandl | 2010-02-07 00:06:24 +0100 (So, 07 Feb 2010) | 1 line

  Add missing imports.
........
  r78040 | georg.brandl | 2010-02-07 00:08:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix a few UnboundLocalErrors in test_long.
........
  r78042 | georg.brandl | 2010-02-07 00:12:12 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
  r78043 | georg.brandl | 2010-02-07 00:12:19 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
  r78046 | georg.brandl | 2010-02-07 00:18:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix various missing import/unbound name errors.
........
  r78048 | georg.brandl | 2010-02-07 00:23:45 +0100 (So, 07 Feb 2010) | 1 line

  We heard you like test failures so we put unbound locals in your test so that you can fail while you fail.
........
  r78049 | georg.brandl | 2010-02-07 00:33:33 +0100 (So, 07 Feb 2010) | 1 line

  Fix import/access for some identifiers.  _TestSharedCTypes does not seem to be executed?
........
  r78050 | georg.brandl | 2010-02-07 00:34:10 +0100 (So, 07 Feb 2010) | 1 line

  Fix more unbound locals in code paths that do not seem to be used.
........
  r78051 | georg.brandl | 2010-02-07 00:53:52 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78052 | georg.brandl | 2010-02-07 00:54:04 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78054 | georg.brandl | 2010-02-07 00:58:25 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
  r78059 | georg.brandl | 2010-02-07 12:34:15 +0100 (So, 07 Feb 2010) | 1 line

  Use "regexp" consistently.
........
  r78075 | georg.brandl | 2010-02-07 13:16:12 +0100 (So, 07 Feb 2010) | 1 line

  Fix another duplicated test method.
........
  r78076 | georg.brandl | 2010-02-07 13:19:43 +0100 (So, 07 Feb 2010) | 1 line

  Fix wrong usage of "except X, Y:".
........
  r78077 | georg.brandl | 2010-02-07 13:25:50 +0100 (So, 07 Feb 2010) | 1 line

  Fix two redefined test methods.
........
  r78078 | georg.brandl | 2010-02-07 13:27:06 +0100 (So, 07 Feb 2010) | 1 line

  Fix a redefined test method.
........
  r78079 | georg.brandl | 2010-02-07 13:34:26 +0100 (So, 07 Feb 2010) | 1 line

  Add a minimal test for fnmatchcase().
........
  r78080 | georg.brandl | 2010-02-07 13:55:12 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
2010-03-14 10:23:39 +00:00
Benjamin Peterson 79e0b818c5 Merged revisions 77737 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r77737 | benjamin.peterson | 2010-01-24 21:37:42 -0600 (Sun, 24 Jan 2010) | 9 lines

  Merged revisions 77735 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r77735 | benjamin.peterson | 2010-01-24 21:31:13 -0600 (Sun, 24 Jan 2010) | 1 line

    fix an UnboundLocalError when the release file is empty #7773
  ........
................
2010-01-25 03:40:53 +00:00