bee_python 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{build/README → README} +1 -1
- data/egg/egg/build.yml +11 -49
- data/egg/egg.yml +19 -27
- data/egg/http/build.erb +32 -36
- data/egg/http/libhttp.py +102 -0
- data/egg/http/pylint.cfg +236 -0
- data/egg/http/server.py +7 -0
- data/egg/http/test.erb +32 -0
- data/egg/http.yml +33 -29
- data/egg/mysql/mysql.py +8 -9
- data/egg/project/build.erb +21 -53
- data/egg/project/pylint.cfg +236 -0
- data/egg/project/test.py +2 -2
- data/egg/project.yml +23 -31
- data/egg/script/build.erb +18 -23
- data/egg/script/pylint.cfg +236 -0
- data/egg/script.yml +22 -18
- data/egg/source/source.py +6 -6
- data/egg/test/test.py +1 -1
- data/lib/bee_task_python.rb +3 -34
- data/python.yml +123 -0
- metadata +61 -503
- data/test/build.yml +0 -16
- data/test/tc_bee_task_python.rb +0 -27
- data/test/test_build.rb +0 -26
- data/test/test_build_listener.rb +0 -110
- data/test/ts_bee_python.rb +0 -26
- data/tools/common/__init__.py +0 -5
- data/tools/common/common/__init__.py +0 -140
- data/tools/common/common/__pkginfo__.py +0 -43
- data/tools/common/common/adbh.py +0 -35
- data/tools/common/common/cache.py +0 -114
- data/tools/common/common/changelog.py +0 -234
- data/tools/common/common/clcommands.py +0 -181
- data/tools/common/common/cli.py +0 -212
- data/tools/common/common/compat.py +0 -328
- data/tools/common/common/configuration.py +0 -1087
- data/tools/common/common/contexts.py +0 -58
- data/tools/common/common/corbautils.py +0 -117
- data/tools/common/common/daemon.py +0 -171
- data/tools/common/common/date.py +0 -279
- data/tools/common/common/db.py +0 -49
- data/tools/common/common/dbf.py +0 -229
- data/tools/common/common/debugger.py +0 -208
- data/tools/common/common/decorators.py +0 -190
- data/tools/common/common/deprecation.py +0 -118
- data/tools/common/common/fileutils.py +0 -409
- data/tools/common/common/graph.py +0 -259
- data/tools/common/common/html.py +0 -142
- data/tools/common/common/interface.py +0 -76
- data/tools/common/common/logging_ext.py +0 -166
- data/tools/common/common/modutils.py +0 -670
- data/tools/common/common/optik_ext.py +0 -383
- data/tools/common/common/optparser.py +0 -92
- data/tools/common/common/pdf_ext.py +0 -111
- data/tools/common/common/proc.py +0 -276
- data/tools/common/common/pyro_ext.py +0 -146
- data/tools/common/common/pytest.py +0 -754
- data/tools/common/common/shellutils.py +0 -383
- data/tools/common/common/sphinx_ext.py +0 -87
- data/tools/common/common/sphinxutils.py +0 -122
- data/tools/common/common/sqlgen.py +0 -31
- data/tools/common/common/table.py +0 -930
- data/tools/common/common/tasksqueue.py +0 -97
- data/tools/common/common/test/__init__.py +0 -1
- data/tools/common/common/test/data/ChangeLog +0 -184
- data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/common/common/test/data/__init__.py +0 -1
- data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/content_differ_dir/README +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/file_differ_dir/README +0 -1
- data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/common/common/test/data/find_test/__init__.py +0 -0
- data/tools/common/common/test/data/find_test/foo.txt +0 -0
- data/tools/common/common/test/data/find_test/module.py +0 -0
- data/tools/common/common/test/data/find_test/module2.py +0 -0
- data/tools/common/common/test/data/find_test/newlines.txt +0 -0
- data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/common/common/test/data/find_test/nonregr.py +0 -0
- data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/common/common/test/data/find_test/spam.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/common/common/test/data/find_test/test.ini +0 -0
- data/tools/common/common/test/data/find_test/test1.msg +0 -0
- data/tools/common/common/test/data/find_test/test2.msg +0 -0
- data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/common/common/test/data/foo.txt +0 -9
- data/tools/common/common/test/data/module.py +0 -88
- data/tools/common/common/test/data/module2.py +0 -77
- data/tools/common/common/test/data/newlines.txt +0 -3
- data/tools/common/common/test/data/noendingnewline.py +0 -36
- data/tools/common/common/test/data/nonregr.py +0 -14
- data/tools/common/common/test/data/normal_file.txt +0 -0
- data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/common/common/test/data/reference_dir/README +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/same_dir/NOTHING +0 -0
- data/tools/common/common/test/data/same_dir/README +0 -1
- data/tools/common/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/spam.txt +0 -9
- data/tools/common/common/test/data/sub/doc.txt +0 -1
- data/tools/common/common/test/data/sub/momo.py +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/test.ini +0 -20
- data/tools/common/common/test/data/test1.msg +0 -30
- data/tools/common/common/test/data/test2.msg +0 -42
- data/tools/common/common/test/data/write_protected_file.txt +0 -0
- data/tools/common/common/test/foomod.py +0 -17
- data/tools/common/common/test/unittest_cache.py +0 -129
- data/tools/common/common/test/unittest_changelog.py +0 -37
- data/tools/common/common/test/unittest_compat.py +0 -239
- data/tools/common/common/test/unittest_configuration.py +0 -348
- data/tools/common/common/test/unittest_date.py +0 -154
- data/tools/common/common/test/unittest_decorators.py +0 -62
- data/tools/common/common/test/unittest_deprecation.py +0 -76
- data/tools/common/common/test/unittest_fileutils.py +0 -133
- data/tools/common/common/test/unittest_graph.py +0 -50
- data/tools/common/common/test/unittest_html.py +0 -76
- data/tools/common/common/test/unittest_interface.py +0 -87
- data/tools/common/common/test/unittest_modutils.py +0 -244
- data/tools/common/common/test/unittest_pytest.py +0 -50
- data/tools/common/common/test/unittest_shellutils.py +0 -248
- data/tools/common/common/test/unittest_table.py +0 -448
- data/tools/common/common/test/unittest_taskqueue.py +0 -71
- data/tools/common/common/test/unittest_testlib.py +0 -956
- data/tools/common/common/test/unittest_textutils.py +0 -247
- data/tools/common/common/test/unittest_tree.py +0 -248
- data/tools/common/common/test/unittest_umessage.py +0 -55
- data/tools/common/common/test/unittest_ureports_html.py +0 -64
- data/tools/common/common/test/unittest_ureports_text.py +0 -105
- data/tools/common/common/test/unittest_xmlutils.py +0 -75
- data/tools/common/common/test/utils.py +0 -87
- data/tools/common/common/testlib.py +0 -1927
- data/tools/common/common/textutils.py +0 -476
- data/tools/common/common/tree.py +0 -372
- data/tools/common/common/umessage.py +0 -161
- data/tools/common/common/ureports/__init__.py +0 -174
- data/tools/common/common/ureports/docbook_writer.py +0 -139
- data/tools/common/common/ureports/html_writer.py +0 -131
- data/tools/common/common/ureports/nodes.py +0 -201
- data/tools/common/common/ureports/text_writer.py +0 -140
- data/tools/common/common/vcgutils.py +0 -216
- data/tools/common/common/visitor.py +0 -107
- data/tools/common/common/xmlrpcutils.py +0 -136
- data/tools/common/common/xmlutils.py +0 -61
- data/tools/coverage/coverage.py +0 -602
- data/tools/epydoc/__init__.py +0 -227
- data/tools/epydoc/__init__.pyc +0 -0
- data/tools/epydoc/apidoc.py +0 -2203
- data/tools/epydoc/apidoc.pyc +0 -0
- data/tools/epydoc/checker.py +0 -349
- data/tools/epydoc/checker.pyc +0 -0
- data/tools/epydoc/cli.py +0 -1470
- data/tools/epydoc/cli.pyc +0 -0
- data/tools/epydoc/compat.py +0 -250
- data/tools/epydoc/compat.pyc +0 -0
- data/tools/epydoc/docbuilder.py +0 -1358
- data/tools/epydoc/docbuilder.pyc +0 -0
- data/tools/epydoc/docintrospecter.py +0 -1056
- data/tools/epydoc/docintrospecter.pyc +0 -0
- data/tools/epydoc/docparser.py +0 -2113
- data/tools/epydoc/docparser.pyc +0 -0
- data/tools/epydoc/docstringparser.py +0 -1111
- data/tools/epydoc/docstringparser.pyc +0 -0
- data/tools/epydoc/docwriter/__init__.py +0 -12
- data/tools/epydoc/docwriter/__init__.pyc +0 -0
- data/tools/epydoc/docwriter/dotgraph.py +0 -1351
- data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
- data/tools/epydoc/docwriter/html.py +0 -3491
- data/tools/epydoc/docwriter/html.pyc +0 -0
- data/tools/epydoc/docwriter/html_colorize.py +0 -909
- data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
- data/tools/epydoc/docwriter/html_css.py +0 -550
- data/tools/epydoc/docwriter/html_css.pyc +0 -0
- data/tools/epydoc/docwriter/html_help.py +0 -190
- data/tools/epydoc/docwriter/html_help.pyc +0 -0
- data/tools/epydoc/docwriter/latex.py +0 -1187
- data/tools/epydoc/docwriter/latex.pyc +0 -0
- data/tools/epydoc/docwriter/plaintext.py +0 -276
- data/tools/epydoc/docwriter/plaintext.pyc +0 -0
- data/tools/epydoc/docwriter/xlink.py +0 -505
- data/tools/epydoc/docwriter/xlink.pyc +0 -0
- data/tools/epydoc/gui.py +0 -1148
- data/tools/epydoc/gui.pyc +0 -0
- data/tools/epydoc/log.py +0 -204
- data/tools/epydoc/log.pyc +0 -0
- data/tools/epydoc/markup/__init__.py +0 -623
- data/tools/epydoc/markup/__init__.pyc +0 -0
- data/tools/epydoc/markup/doctest.py +0 -311
- data/tools/epydoc/markup/doctest.pyc +0 -0
- data/tools/epydoc/markup/epytext.py +0 -2116
- data/tools/epydoc/markup/epytext.pyc +0 -0
- data/tools/epydoc/markup/javadoc.py +0 -250
- data/tools/epydoc/markup/javadoc.pyc +0 -0
- data/tools/epydoc/markup/plaintext.py +0 -78
- data/tools/epydoc/markup/plaintext.pyc +0 -0
- data/tools/epydoc/markup/pyval_repr.py +0 -532
- data/tools/epydoc/markup/pyval_repr.pyc +0 -0
- data/tools/epydoc/markup/restructuredtext.py +0 -906
- data/tools/epydoc/markup/restructuredtext.pyc +0 -0
- data/tools/epydoc/test/__init__.py +0 -97
- data/tools/epydoc/test/__init__.pyc +0 -0
- data/tools/epydoc/test/util.py +0 -226
- data/tools/epydoc/test/util.pyc +0 -0
- data/tools/epydoc/util.py +0 -289
- data/tools/epydoc/util.pyc +0 -0
- data/tools/logilab/logilab/__init__.py +0 -5
- data/tools/logilab/logilab/astng/__init__.py +0 -82
- data/tools/logilab/logilab/astng/__pkginfo__.py +0 -76
- data/tools/logilab/logilab/astng/_exceptions.py +0 -64
- data/tools/logilab/logilab/astng/_nodes_ast.py +0 -667
- data/tools/logilab/logilab/astng/_nodes_compiler.py +0 -758
- data/tools/logilab/logilab/astng/bases.py +0 -608
- data/tools/logilab/logilab/astng/builder.py +0 -239
- data/tools/logilab/logilab/astng/inference.py +0 -426
- data/tools/logilab/logilab/astng/inspector.py +0 -289
- data/tools/logilab/logilab/astng/manager.py +0 -421
- data/tools/logilab/logilab/astng/mixins.py +0 -165
- data/tools/logilab/logilab/astng/node_classes.py +0 -848
- data/tools/logilab/logilab/astng/nodes.py +0 -85
- data/tools/logilab/logilab/astng/nodes_as_string.py +0 -389
- data/tools/logilab/logilab/astng/patchcomptransformer.py +0 -159
- data/tools/logilab/logilab/astng/protocols.py +0 -333
- data/tools/logilab/logilab/astng/raw_building.py +0 -212
- data/tools/logilab/logilab/astng/rebuilder.py +0 -307
- data/tools/logilab/logilab/astng/scoped_nodes.py +0 -951
- data/tools/logilab/logilab/astng/test/__init__.py +0 -19
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
- data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +0 -33
- data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/all.py +0 -29
- data/tools/logilab/logilab/astng/test/data/appl/__init__.py +0 -23
- data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +0 -30
- data/tools/logilab/logilab/astng/test/data/format.py +0 -34
- data/tools/logilab/logilab/astng/test/data/module.py +0 -90
- data/tools/logilab/logilab/astng/test/data/module2.py +0 -112
- data/tools/logilab/logilab/astng/test/data/noendingnewline.py +0 -57
- data/tools/logilab/logilab/astng/test/data/nonregr.py +0 -76
- data/tools/logilab/logilab/astng/test/data/notall.py +0 -28
- data/tools/logilab/logilab/astng/test/data2/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +0 -51
- data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +0 -32
- data/tools/logilab/logilab/astng/test/regrtest.py +0 -135
- data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +0 -22
- data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +0 -31
- data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +0 -68
- data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +0 -24
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +0 -20
- data/tools/logilab/logilab/astng/test/unittest_builder.py +0 -684
- data/tools/logilab/logilab/astng/test/unittest_inference.py +0 -1112
- data/tools/logilab/logilab/astng/test/unittest_inspector.py +0 -105
- data/tools/logilab/logilab/astng/test/unittest_lookup.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_manager.py +0 -98
- data/tools/logilab/logilab/astng/test/unittest_nodes.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +0 -501
- data/tools/logilab/logilab/astng/test/unittest_utils.py +0 -104
- data/tools/logilab/logilab/astng/utils.py +0 -342
- data/tools/logilab/logilab/common/__init__.py +0 -140
- data/tools/logilab/logilab/common/__pkginfo__.py +0 -43
- data/tools/logilab/logilab/common/adbh.py +0 -35
- data/tools/logilab/logilab/common/cache.py +0 -114
- data/tools/logilab/logilab/common/changelog.py +0 -234
- data/tools/logilab/logilab/common/clcommands.py +0 -181
- data/tools/logilab/logilab/common/cli.py +0 -212
- data/tools/logilab/logilab/common/compat.py +0 -328
- data/tools/logilab/logilab/common/configuration.py +0 -1087
- data/tools/logilab/logilab/common/contexts.py +0 -58
- data/tools/logilab/logilab/common/corbautils.py +0 -117
- data/tools/logilab/logilab/common/daemon.py +0 -171
- data/tools/logilab/logilab/common/date.py +0 -279
- data/tools/logilab/logilab/common/db.py +0 -49
- data/tools/logilab/logilab/common/dbf.py +0 -229
- data/tools/logilab/logilab/common/debugger.py +0 -208
- data/tools/logilab/logilab/common/decorators.py +0 -190
- data/tools/logilab/logilab/common/deprecation.py +0 -118
- data/tools/logilab/logilab/common/fileutils.py +0 -409
- data/tools/logilab/logilab/common/graph.py +0 -259
- data/tools/logilab/logilab/common/html.py +0 -142
- data/tools/logilab/logilab/common/interface.py +0 -76
- data/tools/logilab/logilab/common/logging_ext.py +0 -166
- data/tools/logilab/logilab/common/modutils.py +0 -670
- data/tools/logilab/logilab/common/optik_ext.py +0 -383
- data/tools/logilab/logilab/common/optparser.py +0 -92
- data/tools/logilab/logilab/common/pdf_ext.py +0 -111
- data/tools/logilab/logilab/common/proc.py +0 -276
- data/tools/logilab/logilab/common/pyro_ext.py +0 -146
- data/tools/logilab/logilab/common/pytest.py +0 -754
- data/tools/logilab/logilab/common/shellutils.py +0 -383
- data/tools/logilab/logilab/common/sphinx_ext.py +0 -87
- data/tools/logilab/logilab/common/sphinxutils.py +0 -122
- data/tools/logilab/logilab/common/sqlgen.py +0 -31
- data/tools/logilab/logilab/common/table.py +0 -930
- data/tools/logilab/logilab/common/tasksqueue.py +0 -97
- data/tools/logilab/logilab/common/test/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/ChangeLog +0 -184
- data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/common/test/data/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/content_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/file_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/foo.txt +0 -9
- data/tools/logilab/logilab/common/test/data/module.py +0 -88
- data/tools/logilab/logilab/common/test/data/module2.py +0 -77
- data/tools/logilab/logilab/common/test/data/newlines.txt +0 -3
- data/tools/logilab/logilab/common/test/data/noendingnewline.py +0 -36
- data/tools/logilab/logilab/common/test/data/nonregr.py +0 -14
- data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/same_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/spam.txt +0 -9
- data/tools/logilab/logilab/common/test/data/sub/doc.txt +0 -1
- data/tools/logilab/logilab/common/test/data/sub/momo.py +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/test.ini +0 -20
- data/tools/logilab/logilab/common/test/data/test1.msg +0 -30
- data/tools/logilab/logilab/common/test/data/test2.msg +0 -42
- data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/foomod.py +0 -17
- data/tools/logilab/logilab/common/test/unittest_cache.py +0 -129
- data/tools/logilab/logilab/common/test/unittest_changelog.py +0 -37
- data/tools/logilab/logilab/common/test/unittest_compat.py +0 -239
- data/tools/logilab/logilab/common/test/unittest_configuration.py +0 -348
- data/tools/logilab/logilab/common/test/unittest_date.py +0 -154
- data/tools/logilab/logilab/common/test/unittest_decorators.py +0 -62
- data/tools/logilab/logilab/common/test/unittest_deprecation.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_fileutils.py +0 -133
- data/tools/logilab/logilab/common/test/unittest_graph.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_html.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_interface.py +0 -87
- data/tools/logilab/logilab/common/test/unittest_modutils.py +0 -244
- data/tools/logilab/logilab/common/test/unittest_pytest.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_shellutils.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_table.py +0 -448
- data/tools/logilab/logilab/common/test/unittest_taskqueue.py +0 -71
- data/tools/logilab/logilab/common/test/unittest_testlib.py +0 -956
- data/tools/logilab/logilab/common/test/unittest_textutils.py +0 -247
- data/tools/logilab/logilab/common/test/unittest_tree.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_umessage.py +0 -55
- data/tools/logilab/logilab/common/test/unittest_ureports_html.py +0 -64
- data/tools/logilab/logilab/common/test/unittest_ureports_text.py +0 -105
- data/tools/logilab/logilab/common/test/unittest_xmlutils.py +0 -75
- data/tools/logilab/logilab/common/test/utils.py +0 -87
- data/tools/logilab/logilab/common/testlib.py +0 -1927
- data/tools/logilab/logilab/common/textutils.py +0 -476
- data/tools/logilab/logilab/common/tree.py +0 -372
- data/tools/logilab/logilab/common/umessage.py +0 -161
- data/tools/logilab/logilab/common/ureports/__init__.py +0 -174
- data/tools/logilab/logilab/common/ureports/docbook_writer.py +0 -139
- data/tools/logilab/logilab/common/ureports/html_writer.py +0 -131
- data/tools/logilab/logilab/common/ureports/nodes.py +0 -201
- data/tools/logilab/logilab/common/ureports/text_writer.py +0 -140
- data/tools/logilab/logilab/common/vcgutils.py +0 -216
- data/tools/logilab/logilab/common/visitor.py +0 -107
- data/tools/logilab/logilab/common/xmlrpcutils.py +0 -136
- data/tools/logilab/logilab/common/xmlutils.py +0 -61
- data/tools/pychecker/COPYRIGHT +0 -31
- data/tools/pychecker/ChangeLog +0 -349
- data/tools/pychecker/CodeChecks.py +0 -1969
- data/tools/pychecker/CodeChecks.pyc +0 -0
- data/tools/pychecker/CodeChecks.pyo +0 -0
- data/tools/pychecker/Config.py +0 -475
- data/tools/pychecker/Config.pyc +0 -0
- data/tools/pychecker/Config.pyo +0 -0
- data/tools/pychecker/KNOWN_BUGS +0 -100
- data/tools/pychecker/MAINTAINERS +0 -81
- data/tools/pychecker/NEWS +0 -406
- data/tools/pychecker/OP.py +0 -131
- data/tools/pychecker/OP.pyc +0 -0
- data/tools/pychecker/OP.pyo +0 -0
- data/tools/pychecker/OptionTypes.py +0 -117
- data/tools/pychecker/OptionTypes.pyc +0 -0
- data/tools/pychecker/OptionTypes.pyo +0 -0
- data/tools/pychecker/README +0 -152
- data/tools/pychecker/Stack.py +0 -115
- data/tools/pychecker/Stack.pyc +0 -0
- data/tools/pychecker/Stack.pyo +0 -0
- data/tools/pychecker/TODO +0 -101
- data/tools/pychecker/VERSION +0 -1
- data/tools/pychecker/Warning.py +0 -50
- data/tools/pychecker/Warning.pyc +0 -0
- data/tools/pychecker/Warning.pyo +0 -0
- data/tools/pychecker/__init__.py +0 -17
- data/tools/pychecker/__init__.pyc +0 -0
- data/tools/pychecker/__init__.pyo +0 -0
- data/tools/pychecker/checker.py +0 -961
- data/tools/pychecker/checker.pyc +0 -0
- data/tools/pychecker/checker.pyo +0 -0
- data/tools/pychecker/function.py +0 -159
- data/tools/pychecker/function.pyc +0 -0
- data/tools/pychecker/function.pyo +0 -0
- data/tools/pychecker/msgs.py +0 -175
- data/tools/pychecker/msgs.pyc +0 -0
- data/tools/pychecker/msgs.pyo +0 -0
- data/tools/pychecker/options.py +0 -275
- data/tools/pychecker/options.pyc +0 -0
- data/tools/pychecker/options.pyo +0 -0
- data/tools/pychecker/pcmodules.py +0 -19
- data/tools/pychecker/pcmodules.pyc +0 -0
- data/tools/pychecker/pcmodules.pyo +0 -0
- data/tools/pychecker/printer.py +0 -47
- data/tools/pychecker/printer.pyc +0 -0
- data/tools/pychecker/printer.pyo +0 -0
- data/tools/pychecker/python.py +0 -427
- data/tools/pychecker/python.pyc +0 -0
- data/tools/pychecker/python.pyo +0 -0
- data/tools/pychecker/utils.py +0 -102
- data/tools/pychecker/utils.pyc +0 -0
- data/tools/pychecker/utils.pyo +0 -0
- data/tools/pychecker/warn.py +0 -778
- data/tools/pychecker/warn.pyc +0 -0
- data/tools/pychecker/warn.pyo +0 -0
- data/tools/pylint2/pylint/__init__.py +0 -16
- data/tools/pylint2/pylint/__pkginfo__.py +0 -67
- data/tools/pylint2/pylint/checkers/__init__.py +0 -155
- data/tools/pylint2/pylint/checkers/base.py +0 -749
- data/tools/pylint2/pylint/checkers/classes.py +0 -527
- data/tools/pylint2/pylint/checkers/design_analysis.py +0 -344
- data/tools/pylint2/pylint/checkers/exceptions.py +0 -183
- data/tools/pylint2/pylint/checkers/format.py +0 -367
- data/tools/pylint2/pylint/checkers/imports.py +0 -379
- data/tools/pylint2/pylint/checkers/logging.py +0 -98
- data/tools/pylint2/pylint/checkers/misc.py +0 -128
- data/tools/pylint2/pylint/checkers/newstyle.py +0 -107
- data/tools/pylint2/pylint/checkers/raw_metrics.py +0 -125
- data/tools/pylint2/pylint/checkers/similar.py +0 -333
- data/tools/pylint2/pylint/checkers/string_format.py +0 -239
- data/tools/pylint2/pylint/checkers/typecheck.py +0 -364
- data/tools/pylint2/pylint/checkers/utils.py +0 -208
- data/tools/pylint2/pylint/checkers/variables.py +0 -498
- data/tools/pylint2/pylint/config.py +0 -149
- data/tools/pylint2/pylint/epylint.py +0 -149
- data/tools/pylint2/pylint/gui.py +0 -433
- data/tools/pylint2/pylint/interfaces.py +0 -98
- data/tools/pylint2/pylint/lint.py +0 -914
- data/tools/pylint2/pylint/pyreverse/__init__.py +0 -5
- data/tools/pylint2/pylint/pyreverse/diadefslib.py +0 -229
- data/tools/pylint2/pylint/pyreverse/diagrams.py +0 -247
- data/tools/pylint2/pylint/pyreverse/main.py +0 -123
- data/tools/pylint2/pylint/pyreverse/utils.py +0 -131
- data/tools/pylint2/pylint/pyreverse/writer.py +0 -196
- data/tools/pylint2/pylint/reporters/__init__.py +0 -67
- data/tools/pylint2/pylint/reporters/guireporter.py +0 -36
- data/tools/pylint2/pylint/reporters/html.py +0 -69
- data/tools/pylint2/pylint/reporters/text.py +0 -156
- data/tools/pylint2/pylint/utils.py +0 -518
- data/tools/pylint2/pylint.py +0 -16
@@ -1,118 +0,0 @@
|
|
1
|
-
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
-
#
|
4
|
-
# This file is part of logilab-common.
|
5
|
-
#
|
6
|
-
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
-
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
-
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
-
# later version.
|
10
|
-
#
|
11
|
-
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
-
# details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
-
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
"""Deprecation utilities.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
"""
|
24
|
-
__docformat__ = "restructuredtext en"
|
25
|
-
|
26
|
-
import sys
|
27
|
-
from warnings import warn
|
28
|
-
|
29
|
-
class class_deprecated(type):
|
30
|
-
"""metaclass to print a warning on instantiation of a deprecated class"""
|
31
|
-
|
32
|
-
def __call__(cls, *args, **kwargs):
|
33
|
-
msg = getattr(cls, "__deprecation_warning__",
|
34
|
-
"%s is deprecated" % cls.__name__)
|
35
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
36
|
-
return type.__call__(cls, *args, **kwargs)
|
37
|
-
|
38
|
-
|
39
|
-
def class_renamed(old_name, new_class, message=None):
|
40
|
-
"""automatically creates a class which fires a DeprecationWarning
|
41
|
-
when instantiated.
|
42
|
-
|
43
|
-
>>> Set = class_renamed('Set', set, 'Set is now replaced by set')
|
44
|
-
>>> s = Set()
|
45
|
-
sample.py:57: DeprecationWarning: Set is now replaced by set
|
46
|
-
s = Set()
|
47
|
-
>>>
|
48
|
-
"""
|
49
|
-
clsdict = {}
|
50
|
-
if message is None:
|
51
|
-
message = '%s is deprecated, use %s' % (old_name, new_class.__name__)
|
52
|
-
clsdict['__deprecation_warning__'] = message
|
53
|
-
try:
|
54
|
-
# new-style class
|
55
|
-
return class_deprecated(old_name, (new_class,), clsdict)
|
56
|
-
except (NameError, TypeError):
|
57
|
-
# old-style class
|
58
|
-
class DeprecatedClass(new_class):
|
59
|
-
"""FIXME: There might be a better way to handle old/new-style class
|
60
|
-
"""
|
61
|
-
def __init__(self, *args, **kwargs):
|
62
|
-
warn(message, DeprecationWarning, stacklevel=2)
|
63
|
-
new_class.__init__(self, *args, **kwargs)
|
64
|
-
return DeprecatedClass
|
65
|
-
|
66
|
-
|
67
|
-
def class_moved(new_class, old_name=None, message=None):
|
68
|
-
"""nice wrapper around class_renamed when a class has been moved into
|
69
|
-
another module
|
70
|
-
"""
|
71
|
-
if old_name is None:
|
72
|
-
old_name = new_class.__name__
|
73
|
-
if message is None:
|
74
|
-
message = 'class %s is now available as %s.%s' % (
|
75
|
-
old_name, new_class.__module__, new_class.__name__)
|
76
|
-
return class_renamed(old_name, new_class, message)
|
77
|
-
|
78
|
-
def deprecated(reason=None, stacklevel=2):
|
79
|
-
"""Decorator that raises a DeprecationWarning to print a message
|
80
|
-
when the decorated function is called.
|
81
|
-
"""
|
82
|
-
def deprecated_decorator(func):
|
83
|
-
message = reason or 'this function is deprecated, use %s instead'
|
84
|
-
if '%s' in message:
|
85
|
-
message = message % func.func_name
|
86
|
-
def wrapped(*args, **kwargs):
|
87
|
-
warn(message, DeprecationWarning, stacklevel=stacklevel)
|
88
|
-
return func(*args, **kwargs)
|
89
|
-
wrapped.__name__ = func.__name__
|
90
|
-
wrapped.__doc__ = func.__doc__
|
91
|
-
return wrapped
|
92
|
-
return deprecated_decorator
|
93
|
-
|
94
|
-
@deprecated('replace deprecated_function(f,m) with deprecated(m)(f)')
|
95
|
-
def deprecated_function(func, message=None):
|
96
|
-
return deprecated(message)(func)
|
97
|
-
|
98
|
-
def moved(modpath, objname):
|
99
|
-
"""use to tell that a callable has been moved to a new module.
|
100
|
-
|
101
|
-
It returns a callable wrapper, so that when its called a warning is printed
|
102
|
-
telling where the object can be found, import is done (and not before) and
|
103
|
-
the actual object is called.
|
104
|
-
|
105
|
-
NOTE: the usage is somewhat limited on classes since it will fail if the
|
106
|
-
wrapper is use in a class ancestors list, use the `class_moved` function
|
107
|
-
instead (which has no lazy import feature though).
|
108
|
-
"""
|
109
|
-
def callnew(*args, **kwargs):
|
110
|
-
from logilab.common.modutils import load_module_from_name
|
111
|
-
message = "object %s has been moved to module %s" % (objname, modpath)
|
112
|
-
warn(message, DeprecationWarning, stacklevel=2)
|
113
|
-
m = load_module_from_name(modpath)
|
114
|
-
return getattr(m, objname)(*args, **kwargs)
|
115
|
-
return callnew
|
116
|
-
|
117
|
-
obsolete = deprecated('obsolete is deprecated, use deprecated instead')(deprecated)
|
118
|
-
|
@@ -1,409 +0,0 @@
|
|
1
|
-
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
-
#
|
4
|
-
# This file is part of logilab-common.
|
5
|
-
#
|
6
|
-
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
-
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
-
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
-
# later version.
|
10
|
-
#
|
11
|
-
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
-
# details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
-
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
"""File and file-path manipulation utilities.
|
19
|
-
|
20
|
-
:group path manipulation: first_level_directory, relative_path, is_binary,\
|
21
|
-
get_by_ext, remove_dead_links
|
22
|
-
:group file manipulation: norm_read, norm_open, lines, stream_lines, lines,\
|
23
|
-
write_open_mode, ensure_fs_mode, export
|
24
|
-
:sort: path manipulation, file manipulation
|
25
|
-
"""
|
26
|
-
__docformat__ = "restructuredtext en"
|
27
|
-
|
28
|
-
import sys
|
29
|
-
import shutil
|
30
|
-
import mimetypes
|
31
|
-
from os.path import isabs, isdir, islink, split, exists, walk, normpath, join
|
32
|
-
from os.path import abspath
|
33
|
-
from os import sep, mkdir, remove, listdir, stat, chmod
|
34
|
-
from stat import ST_MODE, S_IWRITE
|
35
|
-
from cStringIO import StringIO
|
36
|
-
|
37
|
-
from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS
|
38
|
-
from logilab.common.shellutils import find
|
39
|
-
|
40
|
-
def first_level_directory(path):
|
41
|
-
"""Return the first level directory of a path.
|
42
|
-
|
43
|
-
>>> first_level_directory('home/syt/work')
|
44
|
-
'home'
|
45
|
-
>>> first_level_directory('/home/syt/work')
|
46
|
-
'/'
|
47
|
-
>>> first_level_directory('work')
|
48
|
-
'work'
|
49
|
-
>>>
|
50
|
-
|
51
|
-
:type path: str
|
52
|
-
:param path: the path for which we want the first level directory
|
53
|
-
|
54
|
-
:rtype: str
|
55
|
-
:return: the first level directory appearing in `path`
|
56
|
-
"""
|
57
|
-
head, tail = split(path)
|
58
|
-
while head and tail:
|
59
|
-
head, tail = split(head)
|
60
|
-
if tail:
|
61
|
-
return tail
|
62
|
-
# path was absolute, head is the fs root
|
63
|
-
return head
|
64
|
-
|
65
|
-
def abspath_listdir(path):
|
66
|
-
"""Lists path's content using absolute paths.
|
67
|
-
|
68
|
-
>>> os.listdir('/home')
|
69
|
-
['adim', 'alf', 'arthur', 'auc']
|
70
|
-
>>> abspath_listdir('/home')
|
71
|
-
['/home/adim', '/home/alf', '/home/arthur', '/home/auc']
|
72
|
-
"""
|
73
|
-
path = abspath(path)
|
74
|
-
return [join(path, filename) for filename in listdir(path)]
|
75
|
-
|
76
|
-
|
77
|
-
def is_binary(filename):
|
78
|
-
"""Return true if filename may be a binary file, according to it's
|
79
|
-
extension.
|
80
|
-
|
81
|
-
:type filename: str
|
82
|
-
:param filename: the name of the file
|
83
|
-
|
84
|
-
:rtype: bool
|
85
|
-
:return:
|
86
|
-
true if the file is a binary file (actually if it's mime type
|
87
|
-
isn't beginning by text/)
|
88
|
-
"""
|
89
|
-
try:
|
90
|
-
return not mimetypes.guess_type(filename)[0].startswith('text')
|
91
|
-
except AttributeError:
|
92
|
-
return 1
|
93
|
-
|
94
|
-
|
95
|
-
def write_open_mode(filename):
|
96
|
-
"""Return the write mode that should used to open file.
|
97
|
-
|
98
|
-
:type filename: str
|
99
|
-
:param filename: the name of the file
|
100
|
-
|
101
|
-
:rtype: str
|
102
|
-
:return: the mode that should be use to open the file ('w' or 'wb')
|
103
|
-
"""
|
104
|
-
if is_binary(filename):
|
105
|
-
return 'wb'
|
106
|
-
return 'w'
|
107
|
-
|
108
|
-
|
109
|
-
def ensure_fs_mode(filepath, desired_mode=S_IWRITE):
|
110
|
-
"""Check that the given file has the given mode(s) set, else try to
|
111
|
-
set it.
|
112
|
-
|
113
|
-
:type filepath: str
|
114
|
-
:param filepath: path of the file
|
115
|
-
|
116
|
-
:type desired_mode: int
|
117
|
-
:param desired_mode:
|
118
|
-
ORed flags describing the desired mode. Use constants from the
|
119
|
-
`stat` module for file permission's modes
|
120
|
-
"""
|
121
|
-
mode = stat(filepath)[ST_MODE]
|
122
|
-
if not mode & desired_mode:
|
123
|
-
chmod(filepath, mode | desired_mode)
|
124
|
-
|
125
|
-
|
126
|
-
class ProtectedFile(file):
|
127
|
-
"""A special file-object class that automatically that automatically
|
128
|
-
does a 'chmod +w' when needed.
|
129
|
-
|
130
|
-
XXX: for now, the way it is done allows 'normal file-objects' to be
|
131
|
-
created during the ProtectedFile object lifetime.
|
132
|
-
One way to circumvent this would be to chmod / unchmod on each
|
133
|
-
write operation.
|
134
|
-
|
135
|
-
One other way would be to :
|
136
|
-
|
137
|
-
- catch the IOError in the __init__
|
138
|
-
|
139
|
-
- if IOError, then create a StringIO object
|
140
|
-
|
141
|
-
- each write operation writes in this StringIO object
|
142
|
-
|
143
|
-
- on close()/del(), write/append the StringIO content to the file and
|
144
|
-
do the chmod only once
|
145
|
-
"""
|
146
|
-
def __init__(self, filepath, mode):
|
147
|
-
self.original_mode = stat(filepath)[ST_MODE]
|
148
|
-
self.mode_changed = False
|
149
|
-
if mode in ('w', 'a', 'wb', 'ab'):
|
150
|
-
if not self.original_mode & S_IWRITE:
|
151
|
-
chmod(filepath, self.original_mode | S_IWRITE)
|
152
|
-
self.mode_changed = True
|
153
|
-
file.__init__(self, filepath, mode)
|
154
|
-
|
155
|
-
def _restore_mode(self):
|
156
|
-
"""restores the original mode if needed"""
|
157
|
-
if self.mode_changed:
|
158
|
-
chmod(self.name, self.original_mode)
|
159
|
-
# Don't re-chmod in case of several restore
|
160
|
-
self.mode_changed = False
|
161
|
-
|
162
|
-
def close(self):
|
163
|
-
"""restore mode before closing"""
|
164
|
-
self._restore_mode()
|
165
|
-
file.close(self)
|
166
|
-
|
167
|
-
def __del__(self):
|
168
|
-
if not self.closed:
|
169
|
-
self.close()
|
170
|
-
|
171
|
-
|
172
|
-
class UnresolvableError(Exception):
|
173
|
-
"""Exception raised by relative path when it's unable to compute relative
|
174
|
-
path between two paths.
|
175
|
-
"""
|
176
|
-
|
177
|
-
def relative_path(from_file, to_file):
|
178
|
-
"""Try to get a relative path from `from_file` to `to_file`
|
179
|
-
(path will be absolute if to_file is an absolute file). This function
|
180
|
-
is useful to create link in `from_file` to `to_file`. This typical use
|
181
|
-
case is used in this function description.
|
182
|
-
|
183
|
-
If both files are relative, they're expected to be relative to the same
|
184
|
-
directory.
|
185
|
-
|
186
|
-
>>> relative_path( from_file='toto/index.html', to_file='index.html')
|
187
|
-
'../index.html'
|
188
|
-
>>> relative_path( from_file='index.html', to_file='toto/index.html')
|
189
|
-
'toto/index.html'
|
190
|
-
>>> relative_path( from_file='tutu/index.html', to_file='toto/index.html')
|
191
|
-
'../toto/index.html'
|
192
|
-
>>> relative_path( from_file='toto/index.html', to_file='/index.html')
|
193
|
-
'/index.html'
|
194
|
-
>>> relative_path( from_file='/toto/index.html', to_file='/index.html')
|
195
|
-
'../index.html'
|
196
|
-
>>> relative_path( from_file='/toto/index.html', to_file='/toto/summary.html')
|
197
|
-
'summary.html'
|
198
|
-
>>> relative_path( from_file='index.html', to_file='index.html')
|
199
|
-
''
|
200
|
-
>>> relative_path( from_file='/index.html', to_file='toto/index.html')
|
201
|
-
Traceback (most recent call last):
|
202
|
-
File "<string>", line 1, in ?
|
203
|
-
File "<stdin>", line 37, in relative_path
|
204
|
-
UnresolvableError
|
205
|
-
>>> relative_path( from_file='/index.html', to_file='/index.html')
|
206
|
-
''
|
207
|
-
>>>
|
208
|
-
|
209
|
-
:type from_file: str
|
210
|
-
:param from_file: source file (where links will be inserted)
|
211
|
-
|
212
|
-
:type to_file: str
|
213
|
-
:param to_file: target file (on which links point)
|
214
|
-
|
215
|
-
:raise UnresolvableError: if it has been unable to guess a correct path
|
216
|
-
|
217
|
-
:rtype: str
|
218
|
-
:return: the relative path of `to_file` from `from_file`
|
219
|
-
"""
|
220
|
-
from_file = normpath(from_file)
|
221
|
-
to_file = normpath(to_file)
|
222
|
-
if from_file == to_file:
|
223
|
-
return ''
|
224
|
-
if isabs(to_file):
|
225
|
-
if not isabs(from_file):
|
226
|
-
return to_file
|
227
|
-
elif isabs(from_file):
|
228
|
-
raise UnresolvableError()
|
229
|
-
from_parts = from_file.split(sep)
|
230
|
-
to_parts = to_file.split(sep)
|
231
|
-
idem = 1
|
232
|
-
result = []
|
233
|
-
while len(from_parts) > 1:
|
234
|
-
dirname = from_parts.pop(0)
|
235
|
-
if idem and len(to_parts) > 1 and dirname == to_parts[0]:
|
236
|
-
to_parts.pop(0)
|
237
|
-
else:
|
238
|
-
idem = 0
|
239
|
-
result.append('..')
|
240
|
-
result += to_parts
|
241
|
-
return sep.join(result)
|
242
|
-
|
243
|
-
|
244
|
-
from logilab.common.textutils import _LINE_RGX
|
245
|
-
from sys import version_info
|
246
|
-
_HAS_UNIV_OPEN = version_info[:2] >= (2, 3)
|
247
|
-
del version_info
|
248
|
-
|
249
|
-
def norm_read(path):
|
250
|
-
"""Return the content of the file with normalized line feeds.
|
251
|
-
|
252
|
-
:type path: str
|
253
|
-
:param path: path to the file to read
|
254
|
-
|
255
|
-
:rtype: str
|
256
|
-
:return: the content of the file with normalized line feeds
|
257
|
-
"""
|
258
|
-
if _HAS_UNIV_OPEN:
|
259
|
-
return open(path, 'U').read()
|
260
|
-
return _LINE_RGX.sub('\n', open(path).read())
|
261
|
-
|
262
|
-
|
263
|
-
def norm_open(path):
|
264
|
-
"""Return a stream for a file with content with normalized line feeds.
|
265
|
-
|
266
|
-
:type path: str
|
267
|
-
:param path: path to the file to open
|
268
|
-
|
269
|
-
:rtype: file or StringIO
|
270
|
-
:return: the opened file with normalized line feeds
|
271
|
-
"""
|
272
|
-
if _HAS_UNIV_OPEN:
|
273
|
-
return open(path, 'U')
|
274
|
-
return StringIO(_LINE_RGX.sub('\n', open(path).read()))
|
275
|
-
|
276
|
-
|
277
|
-
def lines(path, comments=None):
|
278
|
-
"""Return a list of non empty lines in the file located at `path`.
|
279
|
-
|
280
|
-
:type path: str
|
281
|
-
:param path: path to the file
|
282
|
-
|
283
|
-
:type comments: str or None
|
284
|
-
:param comments:
|
285
|
-
optional string which can be used to comment a line in the file
|
286
|
-
(i.e. lines starting with this string won't be returned)
|
287
|
-
|
288
|
-
:rtype: list
|
289
|
-
:return:
|
290
|
-
a list of stripped line in the file, without empty and commented
|
291
|
-
lines
|
292
|
-
|
293
|
-
:warning: at some point this function will probably return an iterator
|
294
|
-
"""
|
295
|
-
stream = norm_open(path)
|
296
|
-
result = stream_lines(stream, comments)
|
297
|
-
stream.close()
|
298
|
-
return result
|
299
|
-
|
300
|
-
|
301
|
-
def stream_lines(stream, comments=None):
|
302
|
-
"""Return a list of non empty lines in the given `stream`.
|
303
|
-
|
304
|
-
:type stream: object implementing 'xreadlines' or 'readlines'
|
305
|
-
:param stream: file like object
|
306
|
-
|
307
|
-
:type comments: str or None
|
308
|
-
:param comments:
|
309
|
-
optional string which can be used to comment a line in the file
|
310
|
-
(i.e. lines starting with this string won't be returned)
|
311
|
-
|
312
|
-
:rtype: list
|
313
|
-
:return:
|
314
|
-
a list of stripped line in the file, without empty and commented
|
315
|
-
lines
|
316
|
-
|
317
|
-
:warning: at some point this function will probably return an iterator
|
318
|
-
"""
|
319
|
-
try:
|
320
|
-
readlines = stream.xreadlines
|
321
|
-
except AttributeError:
|
322
|
-
readlines = stream.readlines
|
323
|
-
result = []
|
324
|
-
for line in readlines():
|
325
|
-
line = line.strip()
|
326
|
-
if line and (comments is None or not line.startswith(comments)):
|
327
|
-
result.append(line)
|
328
|
-
return result
|
329
|
-
|
330
|
-
|
331
|
-
def export(from_dir, to_dir,
|
332
|
-
blacklist=BASE_BLACKLIST, ignore_ext=IGNORED_EXTENSIONS,
|
333
|
-
verbose=0):
|
334
|
-
"""Make a mirror of `from_dir` in `to_dir`, omitting directories and
|
335
|
-
files listed in the black list or ending with one of the given
|
336
|
-
extensions.
|
337
|
-
|
338
|
-
:type from_dir: str
|
339
|
-
:param from_dir: directory to export
|
340
|
-
|
341
|
-
:type to_dir: str
|
342
|
-
:param to_dir: destination directory
|
343
|
-
|
344
|
-
:type blacklist: list or tuple
|
345
|
-
:param blacklist:
|
346
|
-
list of files or directories to ignore, default to the content of
|
347
|
-
`BASE_BLACKLIST`
|
348
|
-
|
349
|
-
:type ignore_ext: list or tuple
|
350
|
-
:param ignore_ext:
|
351
|
-
list of extensions to ignore, default to the content of
|
352
|
-
`IGNORED_EXTENSIONS`
|
353
|
-
|
354
|
-
:type verbose: bool
|
355
|
-
:param verbose:
|
356
|
-
flag indicating whether information about exported files should be
|
357
|
-
printed to stderr, default to False
|
358
|
-
"""
|
359
|
-
def make_mirror(_, directory, fnames):
|
360
|
-
"""walk handler"""
|
361
|
-
for norecurs in blacklist:
|
362
|
-
try:
|
363
|
-
fnames.remove(norecurs)
|
364
|
-
except ValueError:
|
365
|
-
continue
|
366
|
-
for filename in fnames:
|
367
|
-
# don't include binary files
|
368
|
-
for ext in ignore_ext:
|
369
|
-
if filename.endswith(ext):
|
370
|
-
break
|
371
|
-
else:
|
372
|
-
src = join(directory, filename)
|
373
|
-
dest = to_dir + src[len(from_dir):]
|
374
|
-
if verbose:
|
375
|
-
print >> sys.stderr, src, '->', dest
|
376
|
-
if isdir(src):
|
377
|
-
if not exists(dest):
|
378
|
-
mkdir(dest)
|
379
|
-
else:
|
380
|
-
if exists(dest):
|
381
|
-
remove(dest)
|
382
|
-
shutil.copy2(src, dest)
|
383
|
-
try:
|
384
|
-
mkdir(to_dir)
|
385
|
-
except OSError:
|
386
|
-
pass
|
387
|
-
walk(from_dir, make_mirror, None)
|
388
|
-
|
389
|
-
|
390
|
-
def remove_dead_links(directory, verbose=0):
|
391
|
-
"""Recursively traverse directory and remove all dead links.
|
392
|
-
|
393
|
-
:type directory: str
|
394
|
-
:param directory: directory to cleanup
|
395
|
-
|
396
|
-
:type verbose: bool
|
397
|
-
:param verbose:
|
398
|
-
flag indicating whether information about deleted links should be
|
399
|
-
printed to stderr, default to False
|
400
|
-
"""
|
401
|
-
def _remove_dead_link(_, directory, fnames):
|
402
|
-
"""walk handler"""
|
403
|
-
for filename in fnames:
|
404
|
-
src = join(directory, filename)
|
405
|
-
if islink(src) and not exists(src):
|
406
|
-
if verbose:
|
407
|
-
print 'remove dead link', src
|
408
|
-
remove(src)
|
409
|
-
walk(directory, _remove_dead_link, None)
|