diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..fd0ad41 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2017 Alert Logic Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..b4032f9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include alertlogic * \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a69f26d --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +REPO_TEST ?= pypitest +REPO ?= pypi + +.PHONY: dist register register_prod upload upload_prod install uninstall +.DEFAULT_GOAL := dist + +dist: + python setup.py sdist + +register: + python setup.py register -r $(REPO_TEST) + +register_prod: + python setup.py register -r $(REPO) + +upload: + python setup.py sdist upload -r $(REPO_TEST) + +upload_prod: + python setup.py sdist upload -r $(REPO) + +install: + python setup.py install + +uninstall: + pip uninstall alertlogic-cli -y diff --git a/README b/README new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/README @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md index 553f7f1..c57b150 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,48 @@ cd tests configuration enables two log handlers to write messages to the stream and to the syslog. Please provide the command line argument `--logging_config_file` pointing on your custom configuration file to enable your custom log handlers. + +* Building and publishing to the PyPi + +In order to build, publish and test the package you need to create `~/.pypirc`: +``` +[distutils] +index-servers = + pypi + pypitest + +[pypi] +repository=https://pypi.python.org/pypi +username=alertlogic +password=password + +[pypitest] +repository=https://testpypi.python.org/pypi +username=alertlogic +password=password +``` + +After it is created the following commands allow you to build upload and test the package: + +* `make dist` - buids the package and puts it into `dist/` subfolder +* `make upload` - uploads to the `testpypi` server under alertlogic organization +* `make install` - installs the package locally(not from PyPi, to install from PyPi use pip) +* `make uninstall` - removes the package from the system +* `make register` - register the package with testpypi +* `make register_prod` - register the package with pypi +* `make upload` - build and upload version of the package to the testpypi +* `make upload_prod` - build and upload version of the package to the pypi(then can be installed as `pip install alertlogic-cli`) + +In order to install the package remotely from testpypi, after it is uploaded, +use the following command: + +`pip install -i https://testpypi.python.org/pypi alertlogic-cli` + + +In order to manipulate previous releases(delete, hide, etc.) PyPi web interface to be used: +https://pypi.python.org/pypi - for the production +https://testpypi.python.org/pypi - for the testpypi + + +General documentation is listed here: +https://packaging.python.org/distributing/ diff --git a/api_data/sources.json b/alertlogic/api_data/sources.json similarity index 100% rename from api_data/sources.json rename to alertlogic/api_data/sources.json diff --git a/api_data/update.sh b/alertlogic/api_data/update.sh similarity index 100% rename from api_data/update.sh rename to alertlogic/api_data/update.sh diff --git a/alertlogic/dynapi.py b/alertlogic/dynapi.py index b0f5bb3..6e3aff7 100644 --- a/alertlogic/dynapi.py +++ b/alertlogic/dynapi.py @@ -10,7 +10,8 @@ import logging import os.path -API_DATA_DIR = os.path.abspath(os.path.dirname(__file__)+"/../api_data") +API_DATA_DIR = os.path.abspath(os.path.dirname(__file__)+"/api_data") + API_SERVICES = ["sources"] log = logging.getLogger() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..c507426 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = share/README.md \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..edc39d6 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +from distutils.core import setup +from setuptools import find_packages +VERSION = '1.0.0' +setup( + name = 'alertlogic_cli', + packages=find_packages(exclude=['contrib', 'docs', 'tests*']), + scripts = ['alertlogic-cli'], + version = VERSION, + license='MIT', + include_package_data=True, + install_requires=[ + 'requests', + ], + description = 'Command Line Client for Alertlogic Services.', + author = 'Alert Logic Inc.', + author_email = 'support@alertlogic.com', + url = 'https://github.com/alertlogic/alertlogic-cli', + download_url = "https://github.com/alertlogic/alertlogic-cli/archive/%s.tar.gz" % (VERSION), + keywords = ['cli', 'alertlogic'], + classifiers = [], +) \ No newline at end of file