Rev 3640: Fix all calls to tempfile.mkdtemp to osutils.mkdtemp. in file:///v/home/vila/src/bzr/experimental/osx_tests_fix/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Aug 26 09:25:31 BST 2008
At file:///v/home/vila/src/bzr/experimental/osx_tests_fix/
------------------------------------------------------------
revno: 3640
revision-id: v.ladeuil+lp at free.fr-20080826082527-109yyxzc0u24oeel
parent: guillo.gonzo at gmail.com-20080816184333-51of2k7wqi6nwtjo
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: osx_tests_fix
timestamp: Tue 2008-08-26 10:25:27 +0200
message:
Fix all calls to tempfile.mkdtemp to osutils.mkdtemp.
* bzrlib/transform.py:
(TransformPreview.__init__): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
* bzrlib/tests/test_whitebox.py:
(MoreTests.test_relpath): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
* bzrlib/tests/test_setup.py:
(TestSetup.test_build_and_install): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
* bzrlib/tests/test_bundle.py:
(BundleTester.get_checkout): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
* bzrlib/tests/blackbox/test_outside_wt.py:
(TestOutsideWT.test_cwd_log,
TestOutsideWT.test_diff_outside_tree): Use osutils.mkdtemp instead
of tempfile.mkdtemp.
* bzrlib/smart/repository.py:
(SmartServerRepositoryTarball._copy_to_tempdir): Use
osutils.mkdtemp instead of tempfile.mkdtemp.
(SmartServerRepositoryTarball._tarfile_response): Line too long.
* bzrlib/remote.py:
(RemoteRepository._copy_repository_tarball): Use osutils.mkdtemp
instead of tempfile.mkdtemp.
* bzrlib/osutils.py:
(_mac_mkdtemp): Add docstring.
* bzrlib/mail_client.py:
(ExternalMailClient.compose): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
* bzrlib/diff.py:
(DiffFromTool.__init__): Use osutils.mkdtemp instead of
tempfile.mkdtemp.
modified:
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/mail_client.py mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
bzrlib/tests/test_bundle.py test.py-20050630184834-092aa401ab9f039c
bzrlib/tests/test_setup.py test_setup.py-20051208073730-4a59a6368c4efa04
bzrlib/tests/test_whitebox.py whitebox.py-20050530064534-a063aafb4a0a3a04
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2008-08-14 05:29:02 +0000
+++ b/bzrlib/diff.py 2008-08-26 08:25:27 +0000
@@ -682,7 +682,7 @@
path_encoding='utf-8'):
DiffPath.__init__(self, old_tree, new_tree, to_file, path_encoding)
self.command_template = command_template
- self._root = tempfile.mkdtemp(prefix='bzr-diff-')
+ self._root = osutils.mkdtemp(prefix='bzr-diff-')
@classmethod
def from_string(klass, command_string, old_tree, new_tree, to_file,
=== modified file 'bzrlib/mail_client.py'
--- a/bzrlib/mail_client.py 2008-07-05 14:19:34 +0000
+++ b/bzrlib/mail_client.py 2008-08-26 08:25:27 +0000
@@ -130,7 +130,7 @@
"""
if basename is None:
basename = 'attachment'
- pathname = tempfile.mkdtemp(prefix='bzr-mail-')
+ pathname = osutils.mkdtemp(prefix='bzr-mail-')
attach_path = osutils.pathjoin(pathname, basename + extension)
outfile = open(attach_path, 'wb')
try:
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2008-08-16 18:43:33 +0000
+++ b/bzrlib/osutils.py 2008-08-26 08:25:27 +0000
@@ -364,11 +364,15 @@
def _mac_mkdtemp(*args, **kwargs):
+ """Override default mkdtemp to set write group.
+
+ OSX set the group to 'wheel', we want the group to be the user's one
+ instead, so that we can set the group sticky bit if needed."""
tmp_dir = tempfile.mkdtemp(*args, **kwargs)
os.chown(tmp_dir, os.getuid(), os.getgid())
return tmp_dir
-
-
+
+
# Default is to just use the python builtins, but these can be rebound on
# particular platforms.
abspath = _posix_abspath
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-08-14 20:15:21 +0000
+++ b/bzrlib/remote.py 2008-08-26 08:25:27 +0000
@@ -1039,7 +1039,6 @@
# destination
from bzrlib import osutils
import tarfile
- import tempfile
# TODO: Maybe a progress bar while streaming the tarball?
note("Copying repository content as tarball...")
tar_file = self._get_tarball('bz2')
@@ -1049,7 +1048,7 @@
try:
tar = tarfile.open('repository', fileobj=tar_file,
mode='r|bz2')
- tmpdir = tempfile.mkdtemp()
+ tmpdir = osutils.mkdtemp()
try:
_extract_tar(tar, tmpdir)
tmp_bzrdir = BzrDir.open(tmpdir)
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2008-06-25 22:27:57 +0000
+++ b/bzrlib/smart/repository.py 2008-08-26 08:25:27 +0000
@@ -23,7 +23,10 @@
import tempfile
import tarfile
-from bzrlib import errors
+from bzrlib import (
+ errors,
+ osutils,
+ )
from bzrlib.bzrdir import BzrDir
from bzrlib.pack import ContainerSerialiser
from bzrlib.smart.request import (
@@ -357,7 +360,7 @@
osutils.rmtree(tmp_dirname)
def _copy_to_tempdir(self, from_repo):
- tmp_dirname = tempfile.mkdtemp(prefix='tmpbzrclone')
+ tmp_dirname = osutils.mkdtemp(prefix='tmpbzrclone')
tmp_bzrdir = from_repo.bzrdir._format.initialize(tmp_dirname)
tmp_repo = from_repo._format.initialize(tmp_bzrdir)
from_repo.copy_content_into(tmp_repo)
@@ -370,8 +373,8 @@
# all finished; write the tempfile out to the network
temp.seek(0)
return SuccessfulSmartServerResponse(('ok',), temp.read())
- # FIXME: Don't read the whole thing into memory here; rather stream it
- # out from the file onto the network. mbp 20070411
+ # FIXME: Don't read the whole thing into memory here; rather stream
+ # it out from the file onto the network. mbp 20070411
finally:
temp.close()
=== modified file 'bzrlib/tests/blackbox/test_outside_wt.py'
--- a/bzrlib/tests/blackbox/test_outside_wt.py 2008-01-29 11:53:31 +0000
+++ b/bzrlib/tests/blackbox/test_outside_wt.py 2008-08-26 08:25:27 +0000
@@ -19,7 +19,6 @@
"""Black-box tests for running bzr outside of a working tree."""
import os
-import tempfile
from bzrlib import (
osutils,
@@ -32,7 +31,7 @@
"""Test that bzr gives proper errors outside of a working tree."""
def test_cwd_log(self):
- tmp_dir = tempfile.mkdtemp()
+ tmp_dir = osutils.mkdtemp()
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
os.chdir(tmp_dir)
out, err = self.run_bzr('log', retcode=3)
@@ -47,7 +46,7 @@
u' "%s".\n' % url, err)
def test_diff_outside_tree(self):
- tmp_dir = tempfile.mkdtemp()
+ tmp_dir = osutils.mkdtemp()
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
os.chdir(tmp_dir)
self.run_bzr('init branch1')
=== modified file 'bzrlib/tests/test_bundle.py'
--- a/bzrlib/tests/test_bundle.py 2008-06-11 04:20:16 +0000
+++ b/bzrlib/tests/test_bundle.py 2008-08-26 08:25:27 +0000
@@ -17,12 +17,12 @@
from cStringIO import StringIO
import os
import sys
-import tempfile
from bzrlib import (
bzrdir,
errors,
inventory,
+ osutils,
repository,
revision as _mod_revision,
treebuilder,
@@ -455,7 +455,7 @@
"""
if checkout_dir is None:
- checkout_dir = tempfile.mkdtemp(prefix='test-branch-', dir='.')
+ checkout_dir = osutils.mkdtemp(prefix='test-branch-', dir='.')
else:
if not os.path.exists(checkout_dir):
os.mkdir(checkout_dir)
=== modified file 'bzrlib/tests/test_setup.py'
--- a/bzrlib/tests/test_setup.py 2006-10-11 23:08:27 +0000
+++ b/bzrlib/tests/test_setup.py 2008-08-26 08:25:27 +0000
@@ -20,7 +20,6 @@
import sys
import subprocess
import shutil
-import tempfile
from tempfile import TemporaryFile
import bzrlib
@@ -56,7 +55,7 @@
raise TestSkipped('You must have distutils installed to run this test.'
' Usually this can be found by installing "python-dev"')
self.log('test_build running in %s' % os.getcwd())
- install_dir = tempfile.mkdtemp()
+ install_dir = osutils.mkdtemp()
# setup.py must be run from the root source directory, but the tests
# are not necessarily invoked from there
self.source_dir = os.path.dirname(os.path.dirname(bzrlib.__file__))
=== modified file 'bzrlib/tests/test_whitebox.py'
--- a/bzrlib/tests/test_whitebox.py 2006-10-16 01:25:46 +0000
+++ b/bzrlib/tests/test_whitebox.py 2008-08-26 08:25:27 +0000
@@ -36,15 +36,15 @@
if it is inside a branch and return the path relative to the base.
"""
import tempfile
-
+
savedir = os.getcwdu()
- dtmp = tempfile.mkdtemp()
+ dtmp = osutils.mkdtemp()
# On Mac OSX, /tmp actually expands to /private/tmp
dtmp = realpath(dtmp)
def rp(p):
return relpath(dtmp, p)
-
+
try:
# check paths inside dtmp while standing outside it
self.assertEqual(rp(pathjoin(dtmp, 'foo')), 'foo')
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2008-08-13 22:51:55 +0000
+++ b/bzrlib/transform.py 2008-08-26 08:25:27 +0000
@@ -17,7 +17,6 @@
import os
import errno
from stat import S_ISREG, S_IEXEC
-import tempfile
from bzrlib.lazy_import import lazy_import
lazy_import(globals(), """
@@ -1401,7 +1400,7 @@
def __init__(self, tree, pb=DummyProgress(), case_sensitive=True):
tree.lock_read()
- limbodir = tempfile.mkdtemp(prefix='bzr-limbo-')
+ limbodir = osutils.mkdtemp(prefix='bzr-limbo-')
TreeTransformBase.__init__(self, tree, limbodir, pb, case_sensitive)
def canonical_path(self, path):
More information about the bazaar-commits
mailing list