* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/
@ 2011-02-08 9:11 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-08 9:11 UTC (permalink / raw
To: gentoo-commits
commit: d2846dde026585a58c417e9a6b9e599c5fafb54a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 8 09:09:03 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 8 09:09:03 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2846dde
test_import_modules: exempt repoman.herdbase
The repoman.herdbase module requires python with xml support.
---
pym/portage/tests/lint/test_import_modules.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/pym/portage/tests/lint/test_import_modules.py b/pym/portage/tests/lint/test_import_modules.py
index 8d257c5..81ffede 100644
--- a/pym/portage/tests/lint/test_import_modules.py
+++ b/pym/portage/tests/lint/test_import_modules.py
@@ -11,6 +11,7 @@ class ImportModulesTestCase(TestCase):
def testImportModules(self):
expected_failures = frozenset((
+ 'repoman.herdbase', # requires python with xml support
))
for mod in self._iter_modules(PORTAGE_PYM_PATH):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/
@ 2012-08-18 0:09 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2012-08-18 0:09 UTC (permalink / raw
To: gentoo-commits
commit: 205f3f187a94a6d297fa1a9d474b839203b09a7d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 17 23:48:22 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug 17 23:57:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=205f3f18
BashSyntaxTestCase: include new misc dir
---
pym/portage/tests/lint/test_bash_syntax.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pym/portage/tests/lint/test_bash_syntax.py b/pym/portage/tests/lint/test_bash_syntax.py
index aef8d74..3acea66 100644
--- a/pym/portage/tests/lint/test_bash_syntax.py
+++ b/pym/portage/tests/lint/test_bash_syntax.py
@@ -1,9 +1,10 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from itertools import chain
import stat
-from portage.const import BASH_BINARY, PORTAGE_BIN_PATH
+from portage.const import BASH_BINARY, PORTAGE_BASE_PATH, PORTAGE_BIN_PATH
from portage.tests import TestCase
from portage import os
from portage import subprocess_getstatusoutput
@@ -14,7 +15,12 @@ from portage import _unicode_decode, _unicode_encode
class BashSyntaxTestCase(TestCase):
def testBashSyntax(self):
- for parent, dirs, files in os.walk(PORTAGE_BIN_PATH):
+ locations = [PORTAGE_BIN_PATH]
+ misc_dir = os.path.join(PORTAGE_BASE_PATH, "misc")
+ if os.path.isdir(misc_dir):
+ locations.append(misc_dir)
+ for parent, dirs, files in \
+ chain.from_iterable(os.walk(x) for x in locations):
parent = _unicode_decode(parent,
encoding=_encodings['fs'], errors='strict')
for x in files:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/
@ 2013-02-20 19:58 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 5+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2013-02-20 19:58 UTC (permalink / raw
To: gentoo-commits
commit: e8d1337b5936ee058872d25f21b914e96bcbf677
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Feb 20 19:53:53 2013 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Wed Feb 20 19:53:53 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e8d1337b
testCompileModules(): Use builtins.compile() instead of py_compile.compile()
to avoid replacing /dev/null character device with a regular file when
using Python 3.4 (http://bugs.python.org/issue17222).
---
pym/portage/tests/lint/test_compile_modules.py | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/pym/portage/tests/lint/test_compile_modules.py b/pym/portage/tests/lint/test_compile_modules.py
index f90a666..1d44e68 100644
--- a/pym/portage/tests/lint/test_compile_modules.py
+++ b/pym/portage/tests/lint/test_compile_modules.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Gentoo Foundation
+# Copyright 2009-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import itertools
@@ -10,8 +10,6 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode, _unicode_encode
-import py_compile
-
class CompileModulesTestCase(TestCase):
def testCompileModules(self):
@@ -34,13 +32,13 @@ class CompileModulesTestCase(TestCase):
do_compile = True
else:
# Check for python shebang
- f = open(_unicode_encode(x,
- encoding=_encodings['fs'], errors='strict'), 'rb')
- line = _unicode_decode(f.readline(),
- encoding=_encodings['content'], errors='replace')
- f.close()
- if line[:2] == '#!' and \
- 'python' in line:
+ with open(_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict'), 'rb') as f:
+ line = _unicode_decode(f.readline(),
+ encoding=_encodings['content'], errors='replace')
+ if line[:2] == '#!' and 'python' in line:
do_compile = True
if do_compile:
- py_compile.compile(x, cfile='/dev/null', doraise=True)
+ with open(_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict'), 'rb') as f:
+ compile(f.read(), x, 'exec')
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/
@ 2014-02-04 2:53 Mike Frysinger
0 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2014-02-04 2:53 UTC (permalink / raw
To: gentoo-commits
commit: 07bb364537b25eafb35765f590ab64dc02d6dd80
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 4 02:52:22 2014 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Feb 4 02:52:22 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=07bb3645
test_compile_modules: ignore unreadable files/dirs
Some tests will create paths in the tree that are unreadable by the
current user (so as to test portage behavior in that case). Have
the compile test not barf when it finds these things.
---
pym/portage/tests/lint/test_compile_modules.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/pym/portage/tests/lint/test_compile_modules.py b/pym/portage/tests/lint/test_compile_modules.py
index 1d44e68..4888552 100644
--- a/pym/portage/tests/lint/test_compile_modules.py
+++ b/pym/portage/tests/lint/test_compile_modules.py
@@ -1,6 +1,7 @@
# Copyright 2009-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import errno
import itertools
import stat
@@ -13,7 +14,7 @@ from portage import _unicode_decode, _unicode_encode
class CompileModulesTestCase(TestCase):
def testCompileModules(self):
- for parent, dirs, files in itertools.chain(
+ for parent, _dirs, files in itertools.chain(
os.walk(PORTAGE_BIN_PATH),
os.walk(PORTAGE_PYM_PATH)):
parent = _unicode_decode(parent,
@@ -31,11 +32,18 @@ class CompileModulesTestCase(TestCase):
if x[-3:] == '.py':
do_compile = True
else:
- # Check for python shebang
- with open(_unicode_encode(x,
- encoding=_encodings['fs'], errors='strict'), 'rb') as f:
- line = _unicode_decode(f.readline(),
- encoding=_encodings['content'], errors='replace')
+ # Check for python shebang.
+ try:
+ with open(_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict'), 'rb') as f:
+ line = _unicode_decode(f.readline(),
+ encoding=_encodings['content'], errors='replace')
+ except IOError as e:
+ # Some tests create files that are unreadable by the
+ # user (by design), so ignore EACCES issues.
+ if e.errno != errno.EACCES:
+ raise
+ continue
if line[:2] == '#!' and 'python' in line:
do_compile = True
if do_compile:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/
@ 2015-02-01 9:07 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2015-02-01 9:07 UTC (permalink / raw
To: gentoo-commits
commit: 70a41bd4404cccc502a3eacf6335c8d2c9503129
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 30 22:53:50 2015 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Feb 1 09:06:41 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=70a41bd4
test_compile_modules: skip files that require newer Python version
Support skipping Python modules and scripts that require newer Python
version than currently used during compile tests. Add a metadata db that
can be used to store additional information about Python files, and
store the required language version there.
---
pym/portage/tests/lint/metadata.py | 11 +++++++++++
pym/portage/tests/lint/test_compile_modules.py | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/pym/portage/tests/lint/metadata.py b/pym/portage/tests/lint/metadata.py
new file mode 100644
index 0000000..e3f90cb
--- /dev/null
+++ b/pym/portage/tests/lint/metadata.py
@@ -0,0 +1,11 @@
+# Copyright 2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+module_metadata = {
+}
+
+script_metadata = {
+ 'socks5-server.py': {
+ 'required_python': '3.3',
+ },
+}
diff --git a/pym/portage/tests/lint/test_compile_modules.py b/pym/portage/tests/lint/test_compile_modules.py
index 4826cad..51eb8cd 100644
--- a/pym/portage/tests/lint/test_compile_modules.py
+++ b/pym/portage/tests/lint/test_compile_modules.py
@@ -4,9 +4,11 @@
import errno
import itertools
import stat
+import sys
from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, PORTAGE_PYM_PACKAGES
from portage.tests import TestCase
+from portage.tests.lint.metadata import module_metadata, script_metadata
from portage import os
from portage import _encodings
from portage import _unicode_decode, _unicode_encode
@@ -30,6 +32,17 @@ class CompileModulesTestCase(TestCase):
st = os.lstat(x)
if not stat.S_ISREG(st.st_mode):
continue
+
+ bin_path = os.path.relpath(x, PORTAGE_BIN_PATH)
+ mod_path = os.path.relpath(x, PORTAGE_PYM_PATH)
+
+ meta = module_metadata.get(mod_path) or script_metadata.get(bin_path)
+ if meta:
+ req_py = tuple(int(x) for x
+ in meta.get('required_python', '0.0').split('.'))
+ if sys.version_info < req_py:
+ continue
+
do_compile = False
if x[-3:] == '.py':
do_compile = True
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-01 9:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08 9:11 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/lint/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2012-08-18 0:09 Zac Medico
2013-02-20 19:58 Arfrever Frehtes Taifersar Arahesis
2014-02-04 2:53 Mike Frysinger
2015-02-01 9:07 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox