Skip to content

Commit

Permalink
Pypi setup
Browse files Browse the repository at this point in the history
JIRA: PDC-1246
  • Loading branch information
Stanislav Ochotnicky authored and ycheng-aa committed Jan 18, 2016
1 parent bb1a1f6 commit de9003f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 6 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include requirements *
recursive-include docs *
recursive-include tests *
include LICENSE README.markdown tox.ini pdc.bash
global-exclude *.pyc
4 changes: 2 additions & 2 deletions bin/pdc_client
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import optparse
import sys

from beanbag import BeanBagException
import pdc_client
from pdc_client import PDCClient

__version__ = '0.1'

__version__ = pdc_client.get_version()

def debug_request(func):
def wrap(*args, **kwargs):
Expand Down
29 changes: 26 additions & 3 deletions pdc_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
#
import itertools
import json
import os
from os.path import expanduser, isfile, isdir
import sys
from subprocess import Popen, PIPE
import exceptions

import beanbag
import requests
import requests_kerberos
import warnings
from os.path import expanduser, isfile

from pdc_client import monkey_patch

monkey_patch.monkey_patch_kerberos()

__version__ = '0.2.0'

GLOBAL_CONFIG_FILE = '/etc/pdc/client_config.json'
USER_SPECIFIC_CONFIG_FILE = expanduser('~/.config/pdc/client_config.json')
CONFIG_URL_KEY_NAME = 'host'
Expand All @@ -29,6 +29,29 @@
CONFIG_TOKEN_KEY_NAME = 'token'


def get_version():
fdir = os.path.dirname(os.path.realpath(__file__))
if isdir(os.path.join(fdir, '..', '.git')):
# running from git, try to get info
old_dir = os.getcwd()
os.chdir(fdir)
git = Popen(["git", "describe", "--tags"], stdout=PIPE)
base_ver = git.communicate()[0].strip()
git = Popen(["git", "rev-parse", "--short", "HEAD"], stdout=PIPE)
hash = git.communicate()[0]
os.chdir(old_dir)
return base_ver + "-" + hash
else:
# not running from git, get info from pkg_resources
import pkg_resources
try:
return pkg_resources.get_distribution("pdc_client").version
except pkg_resources.DistributionNotFound:
return "unknown"

__version__ = get_version()


def _read_file(file_path):
data = {}
if isfile(file_path):
Expand Down
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
"""
Setup script
"""
import os
import sys

from setuptools import find_packages, setup

__version__='0.2.0.2'

setup(
name = 'pdc-client',
description = 'Client library and console client for Product Definition Center',
install_requires = [ 'beanbag >= 1.9.2', 'requests-kerberos'],
version = __version__,
license = 'MIT',
download_url = 'https://github.com/product-definition-center/pdc-client/releases',
url = 'https://github.com/product-definition-center/pdc-client',
packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*",
"tests"]),
scripts = ["bin/pdc", "bin/pdc_client"],
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Topic :: Software Development :: Libraries',
'Topic :: Utilities'
]
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = docs,*.pyc,*.py~,*.in,*.spec,*.sh,*.rst
exclude = docs,*.pyc,*.py~,*.in,*.spec,*.sh,*.rst,setup.py
filename = *.py
ignore = E501,E402,E221

0 comments on commit de9003f

Please sign in to comment.