好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

浅析python打包工具distutils、setuptools

python包在开发中十分常见,一般的使用套路是所有的功能做一个python模块包,打包模块,然后发布,安装使用。这篇文章给大家介绍了python打包工具distutils、setuptools的相关知识,感兴趣的朋友一起看看吧

def hello_fun():
 print "i say hello to you" 
from distutils.core import setup
setup(
 name="hello_module",
 version="1.0",
 author="ljk",
 author_email="wilber@sh测试数据",
 py_modules=['hello'],
) 
import os
def fun():
 print "i am in the path:"
 print os.getcwd() 
#-*- encoding: UTF-8 -*-
from setuptools import setup
setup(
 name = "demo",    # 包名
 version = "0.1",    # 版本信息
 packages = ['demo'],   # 要打包的项目文件夹
 include_package_data=True, # 自动打包文件夹内所有数据
 zip_safe=True,    # 设定项目包为安全,不用每次都检测其安全性
 install_requires = [   # 安装依赖的其他包(测试数据)
 'docutils>=0.3',
 'requests',
 ],
 # 设置程序的入口为path
 # 安装后,命令行执行path相当于调用get_path.py中的fun方法
 entry_points={
  'console_scripts':[
   'path = demo.get_path:fun'
          ]
 },
)
<br data-filtered="filtered"><br data-filtered="filtered"> 
from setuptools import setup
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
setup.cfg

[metadata]
name= keystone
version= 2015.2
summary= OpenStack Identity
description-file=
README.rst
author= OpenStack
author-email= openstack-dev@lists.openstack.org
home-page= http://HdhCmsTestopenstack.org/
classifier=
Environment:: OpenStack
IntendedAudience :: Information Technology
IntendedAudience :: System Administrators
License:: OSI Approved :: Apache Software License
OperatingSystem :: POSIX :: Linux
ProgrammingLanguage :: Python
ProgrammingLanguage :: Python :: 2
ProgrammingLanguage :: Python :: 2.7
[files]
packages=
keystone
[global]
setup-hooks=
pbr.hooks.setup_hook
[egg_info]
tag_build=
tag_date= 0
tag_svn_revision= 0
[build_sphinx]
all_files= 1
build-dir= doc/build
source-dir= doc/source
[compile_catalog]
directory= keystone/locale
domain= keystone 

以上就是浅析python打包工具distutils、setuptools的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于浅析python打包工具distutils、setuptools的详细内容...

  阅读:41次