On branch swig-py3: Update swig python code to be compatible with both Python 2
and Python3.
Change non-generated python code to use syntax that is valid for both Python 3
and Python 2.7. Where this is not possible, provide compatibility wrappers.
Python 2 unit tests all pass after the changes, but more effort remains for full
Python 3 functionality.
* build/generator/swig/header_wrappers.py
(_write_swig_interface_file): For Python3, include an encoding argument to
tempfile.TemporaryFile()
* build/generator/util/executable.py
(output): Ensure the subprocess' output is interpreted as utf8 for proper
Python 3 compatibility.
[in subversion/bindings/swig/python]
* svn/core.py
Import the builtin 'list' as '_bi_list' to aid in compatibility in other
modules.
(_unprefix_names): Wrap dict.items() in list() for py2.7/3 support.
(__all__): Change filter() to list comprehension for py2.7/3 support.
* svn/client.py
svn/delta.py
svn/diff.py
svn/fs.py
svn/ra.py
svn/repos.py
svn/wc.py
(__all__): Change filter() to list comprehension for py2.7/3 support. Use the
_bi_list to provide a new list instance of locals on both Python 2.7 and 3.
* svn/fs.py
(entries): Wrap dict.items() in _bi_list() for py2.7/3 support.
* tests/auth.py
(test_open): Change deprecated assert_ to assertTrue.
(test_credentials_get_username,
test_credentials_get_simple,
test_credentials_get_ssl_client_cert,
test_credentials_get_ssl_client_cert_pw,
test_credentials_get_ssl_server_trust):
Change deprecated assertEquals to assertEqual and assert_ to assertTrue.
* tests/client.py
(setUp, test_log5, proplist_receiver_trunk, proplist_receiver_dir1,
test_inherited_props, test_update4):
Change deprecated assertEquals to assertEqual.
(testBatonPlay): Change deprecated assertEquals to assertEqual and
assertNotEquals to assertNotEqual.
(test_log3_url, test_platform_providers):
Change deprecated assert_ to assertTrue.
(test_log5): Change deprecated assert_ to assertTrue and assertEquals to
assertEqual.
* tests/core.py
(test_config_enumerate2): Replace dict.iteritems() with dict.items() to be
compatible with py2.7/3. Change deprecated assert_ to assertTrue.
(test_config_enumerate_sections2): Change deprecated assert_ to assertTrue.
* tests/delta.py
(testTxdeltaWindowT): Change deprecated assert_ to assertTrue.
* tests/mergeinfo.py
(test_rangelist_reverse,
test_mergeinfo_leakage__incorrect_range_t_refcounts,
test_mergeinfo_leakage__lingering_range_t_objects_after_del,
inspect_mergeinfo_dict):
Change deprecated assertEquals to assertEqual.
(test_mergeinfo_leakage__incorrect_range_t_refcounts): Wrap dict.items() in
list() for py2.7/3 support. Change deprecated assertEquals to assertEqual.
(inspect_mergeinfo_dict): Change deprecated assert_ to assertTrue.
(compare_mergeinfo_catalogs,
compare_mergeinfos):
Drop usage of dict.keys() for py2.7/3 support.
* tests/ra.py
(test_get_dir2, test_delta_driver_commit, test_get_file_revs,
test_lock, test_get_log2, test_namestring):
Change deprecated assert_ to assertTrue.
(test_delta_driver_commit): Wrap dict.items() in list() for py2.7/3 support.
* tests/repository.py
(test_dump_fs2): Change deprecated assertEquals to assertEqual.
(test_get_logs): Wrap dict.values() in list() for py2.7/3 support.
* tests/run_all.py
(suite): Do not use long() cast when running with Python 3.
* tests/utils.py
Support correct import of StringIO and pathname2url from Python 2.7 and 3.
(file_uri_for_path): Use unqualified pathname2url to support py2.7/3.
* tests/wc.py
(test_is_adm_dir, test_set_adm_dir, test_status_editor,
test_is_normal_prop, test_is_wc_prop, test_is_entry_prop):
Change deprecated assert_ to assertTrue and failIf to assertFalse.
(test_get_adm_dir, test_crawl_revisions2, test_check_wc, test_get_prop_diffs,
test_get_ignores):
Change deprecated assert_ with assertTrue.
(test_commit): Change deprecated assertEquals to assertEqual.
(test_diff_editor4): Wrap dict.items() in list() for py2.7/3 support.
* tests/trac/versioncontrol/svn_fs.py
(get_entries): Drop usage of dict.keys() for py2.7/3 support.
(get_properties, get_changes): Wrap dict.items() with list() for py2.7/3
support.
* tests/trac/versioncontrol/tests/svn_fs.py
Support correct import of StringIO and pathname2url from Python 2.7 and 3.
(test_get_dir_entries, test_get_file_entries, test_get_node_history,
test_get_node_history_follow_copy, test_get_path_history,
test_get_path_history_copied_file, test_get_path_history_copied_dir,
test_changeset_added_dirs, test_changeset_file_edit, test_changset_dir_moves,
test_changeset_file_copy):
Replace the series of direct calls to .next() with assertSequenceEqual for
py2.7/3 support.
(test_diff_file_different_revs, test_diff_file_different_files,
test_diff_file_no_change, test_diff_dir_different_revs,
test_diff_dir_different_dirs, test_diff_dir_no_change,
test_changeset_repos_creation):
Replace <iter>.next() with next(<iter>) for py2.7/3 support.