Open AraHaan opened 7 years ago
install-requires
takes a list of names with optionally versions. If you want to pass in a link, you have to use dependency_links
.
Furthermore, don't load a requirements.txt
file. I know this is commonly done but this file is not for installation dependencies but instead for listing packages one wants in an environment.
As much as that is said I know of a few packages that use an requirements.txt file to install dependencies when you pip install it (discord.py being one of said packages).
I guess I could modify the code to where if it finds an git+
or whatever to remove it from the list and into another one. But it would have to know all possible svn's people can link or use on it.
Edit: here is my work arround setup.py.
from setuptools import setup
from setuptools.extension import Extension
import sys
def get_requirements(remove_links=True):
"""
lists the requirements to install.
"""
requirements = []
try:
with open('requirements.txt') as f:
requirements = f.read().splitlines()
except Exception as ex:
with open('DecoraterBotUtils.egg-info\requires.txt') as f:
requirements = f.read().splitlines()
if remove_links:
for requirement in requirements:
# git repository url.
if requirement.startswith("git+"):
requirements.remove(requirement)
# subversion repository url.
if requirement.startswith("svn+"):
requirements.remove(requirement)
# mercurial repository url.
if requirement.startswith("hg+"):
requirements.remove(requirement)
return requirements
def get_links():
"""
gets URL Dependency links.
"""
links_list = get_requirements(remove_links=False)
for link in links_list:
keep_link = False
already_removed = False
# git repository url.
if not link.startswith("git+"):
if not link.startswith("svn+"):
if not link.startswith("hg+"):
links_list.remove(link)
already_removed = True
else:
keep_link = True
if not keep_link and not already_removed:
links_list.remove(link)
already_removed = True
else:
keep_link = True
if not keep_link and not already_removed:
links_list.remove(link)
return links_list
def get_version():
"""
returns version.
"""
return '0.0.1'
def get_extensions():
"""
lists the extensions to build with an compiler.
"""
if sys.platform != 'cygwin':
BotErrors = Extension(
'DecoraterBotUtils.BotErrors', [
'DecoraterBotUtils/BotErrors.c'])
else:
BotErrors = Extension(
'DecoraterBotUtils.BotErrors',
library_dirs=['/usr/local/bin'],
sources=['DecoraterBotUtils/BotErrors.c'])
return [BotErrors]
if not get_version():
raise RuntimeError('version is not set')
try:
with open('README.rst') as f:
readme = f.read()
except FileNotFoundError:
readme = ""
setup(name='DecoraterBotUtils',
author='Decorater',
author_email='seandhunt_7@yahoo.com',
url='https://github.com/DecoraterBot-devs/DecoraterBotUtils',
bugtrack_url='https://github.com/DecoraterBot-devs/DecoraterBotUtils/issues',
version=get_version(),
packages=['DecoraterBotUtils'],
ext_modules=get_extensions(),
license='MIT',
description='This package is for bringing various things to DecoraterBot.',
long_description=readme,
maintainer_email='seandhunt_7@yahoo.com',
download_url='https://github.com/DecoraterBot-devs/DecoraterBotUtils',
include_package_data=True,
install_requires=get_requirements(),
dependency_links=get_links(),
platforms='Any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: C',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
We were able to make it work only using https://github.com/pypa/pip/issues/3610#issuecomment-356687173
We were able to make it work only using https://github.com/pypa/pip/issues/3610#issuecomment-356687173
Here is an example package's
reuirements.txt
andsetup.py
that is hosted on github only that fails every time it is attempted to be installed using pip.Also happens when running setup.py directly without pip.
requirements.txt:
setup.py:
output with pip:
output without pip:
When entering the
get_requirements
and executing it directly in python's interactive mode:In interactive mode it works as expected (without executing setuptools) but in pip for some reason it fails when it should not fail. Unless setuptools cannot process the vcs's properly that pip gladly supports and is able to take in and process just fine.