1998-08-11 00:36:48 +08:00
|
|
|
Q. I want to port Python to a new platform. How do I begin?
|
|
|
|
|
|
|
|
A. I guess the two things to start with is to familiarize yourself
|
|
|
|
with are the development system for your target platform and the
|
|
|
|
generic build process for Python. Make sure you can compile and run a
|
|
|
|
simple hello-world program on your target platform. Make sure you can
|
|
|
|
compile and run the Python interpreter on a platform to which it has
|
|
|
|
already been ported (preferably Unix, but Mac or Windows will do,
|
|
|
|
too).
|
|
|
|
|
|
|
|
I also would never start something like this without at least
|
|
|
|
medium-level understanding of your target platform (i.e. how it is
|
|
|
|
generally used, how to write platform specific apps etc.) and Python
|
|
|
|
(or else you'll never know how to test the results).
|
|
|
|
|
|
|
|
The build process for Python, in particular the Makefiles in the
|
|
|
|
source distribution, will give you a hint on which files to compile
|
|
|
|
for Python. Not all source files are relevant -- some are platform
|
|
|
|
specific, others are only used in emergencies (e.g. getopt.c). The
|
|
|
|
Makefiles tell the story.
|
|
|
|
|
2001-07-26 21:41:06 +08:00
|
|
|
You'll also need a pyconfig.h file tailored for your platform. You can
|
|
|
|
start with pyconfig.h.in, read the comments and turn on definitions that
|
1998-08-11 00:36:48 +08:00
|
|
|
apply to your platform.
|
|
|
|
|
|
|
|
And you'll need a config.c file, which lists the built-in modules you
|
|
|
|
support. Start with Modules/config.c.in.
|
|
|
|
|
|
|
|
Finally, you'll run into some things that aren't supported on your
|
|
|
|
target platform. Forget about the posix module for now -- simply take
|
|
|
|
it out of the config.c file.
|
|
|
|
|
|
|
|
Bang on it until you get a >>> prompt. (You may have to disable the
|
Merged revisions 78966,78970,79018,79026-79027,79055,79156,79159,79163-79164,79173,79176,79194,79208,79212 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78966 | florent.xicluna | 2010-03-14 10:20:59 -0500 (Sun, 14 Mar 2010) | 2 lines
Do not hardcode Expat version. It's possible to build Python with --with-system-expat option.
........
r78970 | benjamin.peterson | 2010-03-14 21:58:24 -0500 (Sun, 14 Mar 2010) | 1 line
this little exception dance is pointless
........
r79018 | collin.winter | 2010-03-16 22:04:01 -0500 (Tue, 16 Mar 2010) | 1 line
Delete unused import.
........
r79026 | vinay.sajip | 2010-03-17 10:05:57 -0500 (Wed, 17 Mar 2010) | 1 line
Issue #8162: logging: Clarified docstring and documentation for disable function.
........
r79027 | collin.winter | 2010-03-17 12:36:16 -0500 (Wed, 17 Mar 2010) | 1 line
Avoid hardcoding refcounts in tests.
........
r79055 | benjamin.peterson | 2010-03-18 16:30:48 -0500 (Thu, 18 Mar 2010) | 1 line
remove installation of deleted test/output dir
........
r79156 | florent.xicluna | 2010-03-20 17:21:02 -0500 (Sat, 20 Mar 2010) | 2 lines
Cleanup test_struct using check_warnings.
........
r79159 | florent.xicluna | 2010-03-20 17:26:42 -0500 (Sat, 20 Mar 2010) | 2 lines
Cleanup test_tarfile, and use check_warnings.
........
r79163 | michael.foord | 2010-03-20 19:53:39 -0500 (Sat, 20 Mar 2010) | 1 line
A faulty load_tests in a test module no longer halts test discovery. A placeholder test, that reports the failure, is created instead.
........
r79164 | michael.foord | 2010-03-20 19:55:58 -0500 (Sat, 20 Mar 2010) | 1 line
Change order of arguments in a unittest function.
........
r79173 | georg.brandl | 2010-03-21 04:09:38 -0500 (Sun, 21 Mar 2010) | 1 line
Document that GzipFile supports iteration.
........
r79176 | georg.brandl | 2010-03-21 04:17:41 -0500 (Sun, 21 Mar 2010) | 1 line
Introduce copy by slicing, used in later chapters.
........
r79194 | florent.xicluna | 2010-03-21 06:58:11 -0500 (Sun, 21 Mar 2010) | 2 lines
Use assertRaises and add a specific warning filter.
........
r79208 | andrew.kuchling | 2010-03-21 13:47:12 -0500 (Sun, 21 Mar 2010) | 1 line
Add items
........
r79212 | georg.brandl | 2010-03-21 14:01:38 -0500 (Sun, 21 Mar 2010) | 1 line
Fix plural.
........
2010-03-22 07:13:07 +08:00
|
|
|
importing of "site.py" by passing the -S option.)
|
1998-08-11 00:36:48 +08:00
|
|
|
|
|
|
|
Then bang on it until it executes very simple Python statements.
|
|
|
|
|
|
|
|
Now bang on it some more. At some point you'll want to use the os
|
2009-06-24 14:42:05 +08:00
|
|
|
module; this is the time to start thinking about what to do with the
|
1998-08-11 00:36:48 +08:00
|
|
|
posix module. It's okay to simply #ifdef out those functions that
|
|
|
|
cause problems; the remaining ones will be quite useful.
|