Changes between Version 20 and Version 21 of PythonGuidelines
- Timestamp:
- Dec 20, 2010, 9:48:25 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PythonGuidelines
v20 v21 8 8 9 9 * WebKit's Python scripts require Python 2.5 or higher to run. 10 * [http://trac.webkit.org/browser/trunk/ WebKitTools/Scripts/test-webkitpy Scripts/test-webkitpy] unit tests the Python code. It also cleans orphan *.pyc files from webkitpy (i.e. .pyc files without a corresponding .py file). You can also do this manually (for all *.pyc files in webkitpy) using the following command:10 * [http://trac.webkit.org/browser/trunk/Tools/Scripts/test-webkitpy Scripts/test-webkitpy] unit tests the Python code. It also cleans orphan *.pyc files from webkitpy (i.e. .pyc files without a corresponding .py file). You can also do this manually (for all *.pyc files in webkitpy) using the following command: 11 11 {{{ 12 find WebKitTools/Scripts -wholename '*.pyc' | xargs rm12 find Tools/Scripts -wholename '*.pyc' | xargs rm 13 13 }}} 14 14 15 15 == Code Structure == 16 16 17 * Most of the Python code is in [http://trac.webkit.org/browser/trunk/ WebKitTools/Scripts/webkitpy WebKitTools/Scripts/webkitpy].18 * [http://trac.webkit.org/browser/trunk/ WebKitTools/Scripts WebKitTools/Scripts] also contains end-user Python scripts (which usually import from webkitpy).19 * Code is written to assume that `.../ WebKitTools/Scripts` is in your `PYTHONPATH`. `test-webkitpy` handles this internally, but you may find it useful to add the setting to your environment.17 * Most of the Python code is in [http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy Tools/Scripts/webkitpy]. 18 * [http://trac.webkit.org/browser/trunk/Tools/Scripts Tools/Scripts] also contains end-user Python scripts (which usually import from webkitpy). 19 * Code is written to assume that `.../Tools/Scripts` is in your `PYTHONPATH`. `test-webkitpy` handles this internally, but you may find it useful to add the setting to your environment. 20 20 * Generally, we try to keep as much of the Python code in webkitpy as possible since this allows the code to be organized more nicely (for unit tests to be in companion files, etc). 21 21 * Unit test files are in correspondence with modules. For example, if module.py is the name of a module, its unit test file would be module_unittest.py and would lie in the same directory. 22 * The root-level folders in webkitpy/ generally correspond to end-user scripts in WebKitTools/Scripts. For example--22 * The root-level folders in webkitpy/ generally correspond to end-user scripts in Tools/Scripts. For example-- 23 23 * check-webkit-style -> webkitpy/style/ 24 24 * new-run-webkit-tests -> webkitpy/layout_tests/ … … 27 27 * webkitpy/common/: code shared by multiple root folders 28 28 * webkitpy/python24/: code that needs to work under Python 2.4 (currently just the version-checking code) 29 * [http://trac.webkit.org/browser/trunk/ WebKitTools/Scripts/webkitpy webkitpy/thirdparty/]: all third-party code in webkitpy29 * [http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy webkitpy/thirdparty/]: all third-party code in webkitpy 30 30 31 31 == Strings and Unicode ==