我有一个应用程序,当没有传递命令行参数时,默认为文件夹./wordlists
中的默认文件。这在主机文件夹中运行得很好,但是一旦我运行setup.py install
,应用程序就会丢失引用,我不确定为什么。你知道吗
这是我现在的工作设置.py地址:
from setuptools import find_packages, setup
def dependencies(file):
with open(file) as f:
return f.read().splitlines()
with open("README.md") as f:
setup(
name="<redacted>",
license="<redacted>",
description="<redacted>",
long_description=f.read(),
author="<redacted>",
author_email="<redacted>",
url="<redacted>",
packages=find_packages(exclude=('tests')),
package_data={'wordlists': ['*.txt', './wordlists/*.txt']},
scripts=['<redacted>'],
install_requires=dependencies('requirements.txt'),
tests_require=dependencies('test-requirements.txt'),
include_package_data=True)
如上所述,我可以在我的目录中运行应用程序,使用:
python ./VHostScan.py -t <target>
然后它将默认为单词列表:
./wordlists/virtual-host-scanning.txt
但是,在使用./setup.py install
并尝试运行应用程序之后,它会丢失到单词列表的链接。你知道吗
这就是我一直试图加入我的设置.py,但我猜我需要在此处进行更改,或者在单词列表引用的位置进行更改:
package_data={'wordlists': ['*.txt', './wordlists/*.txt']},
这是我引用默认单词列表文件的方式:
DEFAULT_WORDLIST_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'wordlists',
'virtual-host-scanning.txt'
)
如果需要的话,这里可以提供完整的代码库:https://github.com/codingo/VHostScan/
您
setup.py
和您的包中的问题:VHostScan.py
,但没有列在setup.py
中;因此它没有安装,也没有包含在二进制发行版中。你知道吗要修复:添加
py_modules=['VHostScan.py']
。你知道吗wordlists
不是Python包,因此find_packages
找不到它,因此package_data
文件不包括在内。你知道吗我有两种解决方法:
a)使目录
wordlists
成为Python包(添加一个空的__init__.py
)b)将
package_data
应用于lib
包:相关问题 更多 >
编程相关推荐