我希望从软件包中安装子目录中的一组sql文件。
project\
thetask\
__init__.py
MainThing.py
sql\
foo\thingone.sql
foo\thingtwo.sql
bar\thingone.sql
bar\thingtwo.sql
README.md
MANIFEST.in
我的MANIFEST.in
仅包含recursive-include sql *.sql
。
我的setup.py
尝试将文件安装在user_config_dir
找到的appdirs
中。
import setuptools
import os
from appdirs import AppDirs
APP_DIRS = AppDirs("table_builder", "thetask")
def long_desc(path_to_md):
"""
Use markdown for description on devpi server.
"""
with open(path_to_md, "r") as _fh:
return _fh.read()
setuptools.setup(
name="mything-thetask",
version="0.1a",
description="Tools for building TheTask tables.",
long_description=long_desc("README.md"),
long_description_content_type="text/markdown",
author="Someguy SomeGuysLastName",
author_email="Someguy.SomeGuysLastName@mything.com",
license="Proprietary",
install_requires=[
"xlrd",
"pyodbc",
"appdirs",
],
include_package_data=True,
packages=setuptools.find_packages(),
scripts=[
"foo.py",
"bar.py",
],
data_files=[
(APP_DIRS.user_config_dir, [
"sql\\foo\\*.sql",
"sql\\bar\\*.sql"
])
],
)
在我的thetask\\table_builder
目录中创建了AppData\\Local
目录,但是install_data
失败并显示:
running install_data
error: can't copy 'sql\foo\*.sql': doesn't exist or not a regular file
----------------------------------------
Command "c:\users\someguy\projects\testinstall\venv\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\someguy\\AppData\\Local\\Temp\\pip-install-bmlgs1fl\\mything-thetask\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\someguy\AppData\Local\Temp\pip-record-ia0ycbsc\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\someguy\projects\testinstall\venv\include\site\python3.7\mything-thetask" failed with error code 1 in C:\Users\someguy\AppData\Local\Temp\pip-install-bmlgs1fl\mything-thetask\
command failed
我希望看到的所有文件都在sql
包的.zip
目录中。我要去哪里错了?
UPDATE:
我试图使用特定的sql文件代替data_files
中的通配符,这消除了该错误,但是没有在AppData\\Local
中安装任何文件。这有点令人沮丧。