在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即可