#-*-coding:utf-8-*-#python#Xiaodeng#python module distutils, packaging ToolsImportdistutils#The Distutils package has 2 purposes:1Distutils wants to make it easy for end users to find the process of installing new modules, packages, and tools consistent and2Distutils wants developers of new modules, packages, and tools to find it easy to create these easy-to-install bundles. Distutils is the module for packaging.#2, how to pack with Distutils? #http://blog.csdn.net/five3/article/details/7847551#setup.pyImportCodecsImportOSImportSYS" "The packaged setup must introduce" " fromDistutils.coreImportSetupdefRead (fname):" "define read () to read the long description under the directory we generally read the contents of the Readme file is called Long description, this will be in the PyPI of your package page show you can also do without this method, directly manually write content PyPI on the support. rst format file, temporarily The MDS format is not supported, and the RST format file is automatically converted to HTML in the PyPI on your package's information page ." " returnCodecs.open (Os.path.join (Os.path.dirname (__file__) (fname)). Read ()#Setup function parameter Description#--------------------------------------------------------------------------#Name='MyTest'" "name: Usually fill in the name of the package can" "PACKAGES=['MyTest']#List of directories that need to be packaged" "Package: Place the name of the module, List form, can be placed multiple; Tell Distutils to process those packages (folders containing __init__.py)" "DESCRIPTION='My First package'" "Description: A basic description of the package" "long_description=read ('Readme.rst')" "Check out the detailed description of the package" "KEYWORDS='Test python package keyword'" "the current package of keywords, convenient pypi classification" "AUTHOR='Xiaodeng' #authorAuthor_email='[email protected]'URL='http://blog.sina.com.cn/u/3712558093'#Project address, no writable pypi on the address of the packageversion='1.0.1'LICENSE='MIT'#Authorization Method#These 3 variables are not added to the setup variable, and can be added to the test when you try.Download_url="' #of the programdata_files="'#Packaging data files, tablets, configuration files, etc.scripts="' #List of footsteps to be performed during installation#Construct SetupSetup (name=NAME, Version=VERSION, Description=DESCRIPTION, Long_description=long_description, classifiers=[ 'License:: OSI Approved:: MIT License', 'programming Language::P Ython', 'intended audience:: Developers', 'Operating System:: OS Independent',], keywords=KEYWORDS, author=AUTHOR, Author_email=author_email, url=URL, License=LICENSE, Packages=PACKAGES, Include_package_data=True, Zip_safe=True, Py_modules=['Test','test1','test2'],#fill in your module py file, which is the list of Python files to package )" "installation >>> python setup.py sdist//Source installation package >>> python setup.py bdist_wininst//windows using >>> py Thon setup.py bdist_rpm//linux under Use" "
Python module distutils, packaging tools