Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update setup.py to enable pip installs direct from github #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from setuptools import setup
from setuptools.command.develop import develop as _develop
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.install import install as _install


def install_regexes():
Expand Down Expand Up @@ -37,6 +38,11 @@ def run(self):
_sdist.run(self)


class install(_install):
def run(self):
install_regexes()
_install.run(self)

setup(
name='ua-parser',
version='0.4.1',
Expand All @@ -50,10 +56,12 @@ def run(self):
url='https://github.com/ua-parser/uap-python',
include_package_data=True,
package_data={'ua_parser': ['regexes.yaml', 'regexes.json']},
setup_requires=['pyyaml'],
install_requires=['pyyaml'],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this line from install_requires=['pyyaml'] to tests_require=['pyyaml'] would let users choose not to install pyyaml if they only want to use the parser, since user_agent_parser.py doesn't use pyyaml, but it would still be installed if python setup.py test was run.

The only other pyyaml usage was in the setup.py itself, and I had to add setup_requires to ensure it was available to the setup.py script.

cmdclass={
'develop': develop,
'sdist': sdist,
'install': install,
},
classifiers=[
'Development Status :: 4 - Beta',
Expand Down