在python中,发布distribution是一个文件集合,这些文件联合在一起允许你构建、打包和发布模块
cat nester.py
#!/usr/bin/python
def print_lol(ss):
for each_item in ss:
if isinstance(each_item,list):
print_lol(each_item)
else:
print(each_item)
cat setup.py
from distutils.core import setup
setup(
name = 'nester',
version = '1.0.0',
py_modules = ['nester'],
author = 'vfe',
author_email = 'vfe@553',
url = 'http://www.fxxkbb.com',
description = 'A simple printer of nested lists')
python2.6 setup.py sdist 构建发布文件
python2.6 setup.py install 将发布安装到python本地副本中
MANIFEST中包含发布的文件列表
cat MANIFEST
nester.py
setup.py
代码在build文件夹下lib文件夹nester.py
dist文件夹中的nester-1.0.0.tar.gz 是发布包
nester.pyc是"编译"版本的代码
需要使用时import netster即可