cpython: 9da64c0bdc33 (original) (raw)

Mercurial > cpython

changeset 71032:9da64c0bdc33

Issue #8746: Correct faulty configure checks so that os.chflags() and os.lchflags() are once again built on systems that support these functions (*BSD and OS X). Also add new stat file flags for OS X (UF_HIDDEN and UF_COMPRESSED). Also add additional tests for os.chflags() and os.lchflags(). (Tests by Garrett Cooper) [#8746]

Ned Deily nad@acm.org
date Tue, 28 Jun 2011 00:13:01 -0700
parents b7c61000ceec(current diff)529e26aa4fa3(diff)
children ef8e9e99de88
files Doc/library/os.rst Lib/test/test_posix.py Misc/ACKS Misc/NEWS configure configure.in pyconfig.h.in
diffstat 9 files changed, 81 insertions(+), 25 deletions(-)[+] [-] Doc/library/os.rst 2 Doc/library/stat.rst 12 Lib/stat.py 2 Lib/test/test_posix.py 57 Misc/ACKS 1 Misc/NEWS 8 configure 8 configure.in 12 pyconfig.h.in 4

line wrap: on

line diff

--- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1465,6 +1465,8 @@ Files and Directories * :data:stat.UF_APPEND * :data:stat.UF_OPAQUE * :data:stat.UF_NOUNLINK

--- a/Doc/library/stat.rst +++ b/Doc/library/stat.rst @@ -307,13 +307,21 @@ The following flags can be used in the * The file may only be appended to. +.. data:: UF_OPAQUE +

.. data:: UF_NOUNLINK The file may not be renamed or deleted. -.. data:: UF_OPAQUE +.. data:: UF_COMPRESSED +

.. data:: SF_ARCHIVED

--- a/Lib/stat.py +++ b/Lib/stat.py @@ -87,6 +87,8 @@ UF_IMMUTABLE = 0x00000002 UF_APPEND = 0x00000004 UF_OPAQUE = 0x00000008 UF_NOUNLINK = 0x00000010 +UF_COMPRESSED = 0x00000020 # OS X: file is hfs-compressed +UF_HIDDEN = 0x00008000 # OS X: file should not be displayed SF_ARCHIVED = 0x00010000 SF_IMMUTABLE = 0x00020000 SF_APPEND = 0x00040000

--- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -16,6 +16,7 @@ import stat import unittest import warnings +_DUMMY_SYMLINK = '%s/dummy-symlink' % os.getenv('TMPDIR', '/tmp') class PosixTester(unittest.TestCase): @@ -23,13 +24,15 @@ class PosixTester(unittest.TestCase): # create empty file fp = open(support.TESTFN, 'w+') fp.close()

def tearDown(self):

def testNoArgFunctions(self): @@ -426,7 +429,7 @@ class PosixTester(unittest.TestCase): def test_lchown(self): os.unlink(support.TESTFN) # create a symlink

def test_chdir(self): @@ -511,17 +514,49 @@ class PosixTester(unittest.TestCase): posix.utime(support.TESTFN, (int(now), int(now))) posix.utime(support.TESTFN, (now, now))

+

+

+

+

+

+

def test_environ(self): if os.name == "nt":

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -191,6 +191,7 @@ Juan José Conti Matt Conway David M. Cooke Jason R. Coombs +Garrett Cooper Greg Copeland Aldo Cortesi David Costanzo

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -857,6 +857,11 @@ Library Build ----- +- Issue #8746: Correct faulty configure checks so that os.chflags() and

--- a/configure +++ b/configure @@ -9912,7 +9912,7 @@ else else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. / -[ + #include <sys/stat.h> #include <unistd.h> int main(int argc, charargv[]) @@ -9921,7 +9921,7 @@ int main(int argc, charargv[]) return 1; return 0; } -] + _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_have_chflags=yes @@ -9961,7 +9961,7 @@ else else cat confdefs.h - <<_ACEOF >conftest.$ac_ext / end confdefs.h. / -[ + #include <sys/stat.h> #include <unistd.h> int main(int argc, charargv[]) @@ -9970,7 +9970,7 @@ int main(int argc, char*argv[]) return 1; return 0; } -] + _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_have_lchflags=yes

--- a/configure.in +++ b/configure.in @@ -2675,7 +2675,7 @@ AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_

On Tru64, chflags seems to be present, but calling it will

exit Python

AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl -AC_RUN_IFELSE([AC_LANG_SOURCE([[[ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <sys/stat.h> #include <unistd.h> int main(int argc, charargv[]) @@ -2684,7 +2684,7 @@ int main(int argc, charargv[]) return 1; return 0; } -]]])], +]])], [ac_cv_have_chflags=yes], [ac_cv_have_chflags=no], [ac_cv_have_chflags=cross]) @@ -2693,11 +2693,11 @@ if test "$ac_cv_have_chflags" = cross ; AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"]) fi if test "$ac_cv_have_chflags" = yes ; then

#include <sys/stat.h> #include <unistd.h> int main(int argc, charargv[]) @@ -2706,13 +2706,13 @@ int main(int argc, charargv[]) return 1; return 0; } -]]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) +]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) ]) if test "$ac_cv_have_lchflags" = cross ; then AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"]) fi if test "$ac_cv_have_lchflags" = yes ; then

--- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -101,7 +101,7 @@ /* Define this if you have the type _Bool. / #undef HAVE_C99_BOOL -/ Define to 1 if you have the chflags' function. */[](#l9.7) +/* Define to 1 if you have the 'chflags' function. */[](#l9.8) #undef HAVE_CHFLAGS[](#l9.9) [](#l9.10) /* Define to 1 if you have the chown' function. */ @@ -428,7 +428,7 @@ Solaris and Linux, the necessary defines are already defined.) / #undef HAVE_LARGEFILE_SUPPORT -/ Define to 1 if you have the lchflags' function. */[](#l9.16) +/* Define to 1 if you have the 'lchflags' function. */[](#l9.17) #undef HAVE_LCHFLAGS[](#l9.18) [](#l9.19) /* Define to 1 if you have the lchmod' function. */