From: Shivani Bhardwaj Date: Fri, 23 Nov 2018 14:55:29 +0000 (+0530) Subject: Install requirements if using pip X-Git-Tag: 1.1.0rc1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f8413ad908bc74b3077000bb2775caed51e35b5;p=thirdparty%2Fsuricata-update.git Install requirements if using pip Current setup was using distutils which does not allow to define the requirements of a package. Check if the installation of `suricata-update` is being done with `pip` and if it is, install the requirements while installing the package. This way distutils will not throw a warning of the `install_requires` option being unrecognized, however, it would still not install the requirements. Now, with the installation of `suricata-update` package, all the requirements are installed as well if it is installed with `pip`. Closes redmine ticket #2667 --- diff --git a/setup.py b/setup.py index a8456b4..14a4b0e 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,11 @@ import os.path import subprocess +import distutils from distutils.core import setup from suricata.update.version import version + def write_git_revision(): if not os.path.exists(".git"): return @@ -17,13 +19,13 @@ def write_git_revision(): write_git_revision() -setup( - name="suricata-update", - version=version, - description="Suricata Update Tool", - author="Jason Ish", - author_email="ish@unx.ca", - packages=[ +args = { + "name": "suricata-update", + "version": version, + "description": "Suricata Update Tool", + "author": "Jason Ish", + "author_email": "ish@unx.ca", + "packages": [ "suricata", "suricata.update", "suricata.update.commands", @@ -32,13 +34,18 @@ setup( "suricata.update.compat.argparse", "suricata.update.data", ], - package_data={"suricata.update.configs": ["*.conf", "*.yaml", "*.in"]}, - url="https://github.com/OISF/suricata-update", - license="GPLv2", - classifiers=[ + "package_data": {"suricata.update.configs": ["*.conf", "*.yaml", "*.in"]}, + "url": "https://github.com/OISF/suricata-update", + "license": "GPLv2", + "classifiers": [ 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', ], - scripts = [ + "scripts": [ "bin/suricata-update", ], -) +} + +if any("pip" in arg for arg in distutils.sys.argv): + args["install_requires"] = ["pyyaml", ] + +setup(**args)