Source code reading summary [to be continue]

After reading part of the source code of old version distribution tool ‘setuptools/distutils’ and current packaging tool ‘Packaging’, there are some good findings for me, and that’s why I just write them here. With the reading day after day, many interesting things will be found, so this post is just in a ‘To Be Continue’ status.

Rename two different distribution/packaging tool here: name ‘setuptools/distribution’ as ‘D1’, name ‘packaging’ as ‘D2’

1 from the point of file structure, the kernel of D1 is, while D2 is

D1: everything is done by different commands, which must derive from Command class
D2: every command should run if things wantted to be done, and that’s why there is an important Dispatcher class in

2 install is just a kind of Command in D1, while building blocks in D2

D1: install is a subclass of Command, and all subcommands will be excuated in its run function, e.g. install_lib, install_data, install_scripts, and so on.
D2: install is just a building block for different installers, and it also support three install methods here – packaging-install, setuptools-install, distributions-install, just for backward compatibility reason. can also be run as script and all of the corresponding subcommands, e.g. install_lib, install_data, will be run in the

To be continue…

This entry was posted in Distutils2, Python. Bookmark the permalink.

3 Responses to Source code reading summary [to be continue]

  1. Éric Araujo says:

    I don’t want to over-mentor you, but let me point out a misunderstanding: packaging.install is a new module you should not care about right now; packaging.command.install_dist is the equivalent of distutils/setuptools install command.

    You don’t have to care about the run module either; focus on commands for now. BTW, learning d2 is more important that setuptools. setuptools/distribute do monkey-patching, network stuff, egg stuff, etc.; you should only have to read the code for the develop command and the functions it uses.

    Last, the kernel of d1 is core and dist IMO; it is more or less run and dist in d2.

    Your article has prompted me to write a short article listing the main differences between d1 and d2; I’ll try to publish it tomorrow. It is not easy to bridge from d1 to d2 when one hasn’t followed the history of the 4 repositories we’ve used.

    • higery says:

      First sorry to reply you a little late, because I was in travling home yesterday( tomorrow is Chinese Dragon Boat Festival).

      Thank you for your article, I will read it carefully and I think it will help me a lot in coding.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s