草庐IT

pre_setup

全部标签

python - setup.py 如何安装 npm 模块?

我实现了一个我想测试的python网络客户端。服务器托管在npm注册表中。在运行我的功能测试之前,服务器使用节点在本地运行。如何从我的setup.py脚本中正确安装npm模块?这是我当前的解决方案,灵感来自post:classCustomInstallCommand(install):defrun(self):arguments=['npm','install','--prefix','test/functional','promisify']subprocess.call(arguments,shell=True)install.run(self)setup(cmdclass={'i

python - 使用 python setup.py sdist 包含空目录

我有一个Python包,我想在其中包含一个空目录作为源代码分发的一部分。我尝试添加includeempty_directory到MANIFEST.in文件,但是当我运行时pythonsetup.pysdist空目录仍然不包括在内。有关如何执行此操作的任何提示? 最佳答案 根据thedocs:includepat1pat2-includeallfilesmatchinganyofthelistedpatternsexcludepat1pat2-excludeallfilesmatchinganyofthelistedpatternsr

python - 如何正确运行 setup.py 文件?

这个问题在这里已经有了答案:Whatissetup.py?(10个答案)关闭7年前。我正在尝试运行这个位于.tat.gz文件中的setup.py文件。我将转到它所在的目录并运行pythonsetup.py但收到此错误消息:brandon@brandon-NV57H:~/Downloads/numpy-1.9.2$pythonsetup.pyRunningfromnumpysourcedirectory./usr/lib/python2.7/distutils/dist.py:267:UserWarning:Unknowndistributionoption:'test_suite'wa

python - 使用 distutils 的 setup.py 编译 C 共享库,当库依赖于第二个共享库时

我在OSX上,试图用distutils的setup.py在C中编译一个共享库(使用ctypes在python中使用)。我是distutils的新手,但是当我要编译的共享库(libreboundx.so)依赖于另一个共享库(librebound.so)时,我遇到了问题。明确地,在modify_orbits_direct.c中我有#include"rebound.h"rebound.h在目录/Users/dt/rebound/src/下,rebound.h中的所有函数都在/Users/dt/rebound/下的共享库librebound.so中。与cc的链接看起来像。cc-fPIC-sha

python - 为什么不推荐使用 setup.py 中的依赖链接?

有相当多的人想知道setup.py中的依赖链接的替代方法(使用pip标志--process-dependency-links激活):Whatisthealternativetousing--process-dependency-linkswithpip,Dependongitrepositoryinsetup.py.基本上,我被弃用警告所困扰:"DEPRECATION:DependencyLinksprocessinghasbeendeprecatedandwillberemovedinafuturerelease."有些人建议使用requirements.txt,但这不是替代方案,因

python - 在 Python distutils 中从 setup.py 查找脚本目录的正确方法?

我正在分发具有这种结构的包:mymodule:mymodule/__init__.pymymodule/code.pyscripts/script1.pyscripts/script2.pymymodulemymodule的子目录包含代码,以及scriptssubdir包含应由用户执行的脚本。在setup.py中描述包安装时,我使用:scripts=['myscripts/script1.py']指定脚本应该放在哪里。在安装过程中,它们通常进入某些平台/用户特定的bin目录。我在mymodule/mymodule中的代码不过需要调用脚本。然后找到这些脚本的完整路径的正确方法是什么?理想

python - setup.py 引入非 Python github 存储库并将它们放在正确的目录中?

是否可以创建一个setup.py文件:pullgithub存储库将该存储库中的文件放入指定文件夹我正在设置一个使用github上提供的第三方JavaScript框架的django包/应用程序。我希望能够让setup.py从github中提取最新版本,然后将这些文件放入适当的static/js文件夹中。因此这不同于普通的依赖项,后者是具有自己的setup.py文件的Python包。 最佳答案 如果您正在使用setuptool(setup.py),则可以使用依赖项要求:https://stackoverflow.com/a/348138

python - 在 Nose 测试课上使用 __init__(self) 而不是 setup(self) 有缺点吗?

为运行nosetests-sclassTestTemp():def__init__(self):print'__init__'self.even=0defsetup(self):print'__setup__'self.odd=1deftest_even(self):print'test_even'even_number=10asserteven_number%2==self.evendeftest_odd(self):print'test_odd'odd_number=11assertodd_number%2==self.odd打印出以下内容。__init____init____se

python - 在 python setup.py data_files 中包含整个目录

设置的data_files参数采用以下格式输入:setup(...data_files=[(target_directory,[listoffilestobeputthere])]....)有没有一种方法可以让我指定整个数据目录,这样我就不必单独命名每个文件并在我更改项目中的实现时更新它?我尝试使用os.listdir(),但我不知道如何使用相对路径,我不能使用os.getcwd()或os.realpath(__file__)因为它们没有正确指向我的存储库根目录。 最佳答案 karelv的想法是正确的,但要更直接地回答所述问题:fr

python - 在涉及 Cython 的 setup.py 中,如果 install_requires,那么如何从库中导入一些东西?

这对我来说没有意义。如何使用setup.py安装Cython,然后还使用setup.py编译库代理?importsys,imp,os,globfromsetuptoolsimportsetupfromCython.Buildimportcythonize#thisisn'tinstalledyetsetup(name='mylib',version='1.0',package_dir={'mylib':'mylib','mylib.tests':'tests'},packages=['mylib','mylib.tests'],ext_modules=cythonize("mylib_