summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/mock-1.0.0/tests/testhelpers.py6
-rw-r--r--python/mozbuild/mozbuild/android_version_code.py2
-rw-r--r--python/mozbuild/mozbuild/jar.py2
-rw-r--r--python/mozbuild/mozbuild/preprocessor.py17
-rw-r--r--python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py2
-rw-r--r--python/psutil/docs/conf.py2
-rwxr-xr-xpython/psutil/examples/top.py2
7 files changed, 13 insertions, 20 deletions
diff --git a/python/mock-1.0.0/tests/testhelpers.py b/python/mock-1.0.0/tests/testhelpers.py
index e788da844..f41023c37 100644
--- a/python/mock-1.0.0/tests/testhelpers.py
+++ b/python/mock-1.0.0/tests/testhelpers.py
@@ -41,21 +41,21 @@ class AnyTest(unittest2.TestCase):
def test_any_and_datetime(self):
mock = Mock()
- mock(datetime.now(), foo=datetime.now())
+ mock(datetime.utcnow(), foo=datetime.utcnow())
mock.assert_called_with(ANY, foo=ANY)
def test_any_mock_calls_comparison_order(self):
mock = Mock()
- d = datetime.now()
+ d = datetime.utcnow()
class Foo(object):
def __eq__(self, other):
return False
def __ne__(self, other):
return True
- for d in datetime.now(), Foo():
+ for d in datetime.utcnow(), Foo():
mock.reset_mock()
mock(d, foo=d, bar=d)
diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py
index 69ce22b8e..6d9445c63 100644
--- a/python/mozbuild/mozbuild/android_version_code.py
+++ b/python/mozbuild/mozbuild/android_version_code.py
@@ -79,7 +79,7 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
'''
def hours_since_cutoff(buildid):
# The ID is formatted like YYYYMMDDHHMMSS (using
- # datetime.now().strftime('%Y%m%d%H%M%S'); see build/variables.py).
+ # datetime.utcnow().strftime('%Y%m%d%H%M%S'); see build/variables.py).
# The inverse function is time.strptime.
# N.B.: the time module expresses time as decimal seconds since the
# epoch.
diff --git a/python/mozbuild/mozbuild/jar.py b/python/mozbuild/mozbuild/jar.py
index d40751b69..98333482b 100644
--- a/python/mozbuild/mozbuild/jar.py
+++ b/python/mozbuild/mozbuild/jar.py
@@ -460,7 +460,7 @@ class JarMaker(object):
pp.setMarker('%')
pp.out = outf
pp.do_include(inf)
- pp.failUnused(realsrc)
+ pp.warnUnused(realsrc)
outf.close()
inf.close()
return
diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py
index e8aac7057..2e7eed1ca 100644
--- a/python/mozbuild/mozbuild/preprocessor.py
+++ b/python/mozbuild/mozbuild/preprocessor.py
@@ -316,20 +316,13 @@ class Preprocessor:
if defines:
self.context.update(defines)
- def failUnused(self, file):
+ def warnUnused(self, file):
msg = None
if self.actionLevel == 0 and not self.silenceMissingDirectiveWarnings:
- msg = 'no preprocessor directives found'
+ sys.stderr.write('{0}: WARNING: no preprocessor directives found\n'.format(file))
elif self.actionLevel == 1:
- msg = 'no useful preprocessor directives found'
- if msg:
- class Fake(object): pass
- fake = Fake()
- fake.context = {
- 'FILE': file,
- 'LINE': None,
- }
- raise Preprocessor.Error(fake, msg, None)
+ sys.stderr.write('{0}: WARNING: no useful preprocessor directives found\n'.format(file))
+ pass
def setMarker(self, aMarker):
"""
@@ -385,7 +378,7 @@ class Preprocessor:
self.out = output
self.do_include(input, False)
- self.failUnused(input.name)
+ self.warnUnused(input.name)
if depfile:
mk = Makefile()
diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
index 2ef93792b..c58fde86e 100644
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -313,7 +313,7 @@ class LinuxToolchainTest(BaseToolchainTest):
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_LINUX,
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_LINUX,
}
- GCC_4_7_RESULT = ('Only GCC 4.8 or newer is supported '
+ GCC_4_7_RESULT = ('Only GCC 4.9 or newer is supported '
'(found version 4.7.3).')
GXX_4_7_RESULT = GCC_4_7_RESULT
GCC_4_9_RESULT = CompilerResult(
diff --git a/python/psutil/docs/conf.py b/python/psutil/docs/conf.py
index 9fa163b65..ad880110f 100644
--- a/python/psutil/docs/conf.py
+++ b/python/psutil/docs/conf.py
@@ -18,7 +18,7 @@ import os
PROJECT_NAME = "psutil"
AUTHOR = "Giampaolo Rodola'"
-THIS_YEAR = str(datetime.datetime.now().year)
+THIS_YEAR = str(datetime.datetime.utcnow().year)
HERE = os.path.abspath(os.path.dirname(__file__))
diff --git a/python/psutil/examples/top.py b/python/psutil/examples/top.py
index 7aebef1d4..30df417f5 100755
--- a/python/psutil/examples/top.py
+++ b/python/psutil/examples/top.py
@@ -165,7 +165,7 @@ def print_header(procs_status, num_procs):
st.sort(key=lambda x: x[:3] in ('run', 'sle'), reverse=1)
print_line(" Processes: %s (%s)" % (num_procs, ' '.join(st)))
# load average, uptime
- uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time())
+ uptime = datetime.utcnow() - datetime.fromtimestamp(psutil.boot_time())
av1, av2, av3 = os.getloadavg()
line = " Load average: %.2f %.2f %.2f Uptime: %s" \
% (av1, av2, av3, str(uptime).split('.')[0])