What directory structure do you want inside of the distribution archive file? The same as your existing structure?
You could package everything one directory higher (code
in your example) with this modified setup.py:
from distutils.core import setup
setup(
name = 'MyPackage',
description = 'This is my package',
packages = ['mypackage', 'mypackage.subpackage'],
version = '1',
url = 'http://www.mypackage.org/',
author = 'Me',
author_email = 'me@here.com',
script_name = './build/setup.py',
data_files = ['./build/setup.py']
)
You'd run this (in the code
directory):
python build/setup.py sdist
Or, if you want to keep dist
inside of build:
python build/setup.py sdist --dist-dir build/dist
I like the directory structure you're trying for. I've never thought setup.py
was special enough to warrant being in the root code folder. But like it or not, I think that's where users of your distribution will expect it to be. So it's no surprise that you have to trick distutils to do something else. The data_files
parameter is a hack to get your setup.py into the distribution in the same place you've located it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…