Initial hpgit python project

Initial files for the hpgit python project

Change-Id: Iebd1f5aa789dcd9574a00bb8837e4596bf55fa88
JIRA: CICD-242
This commit is contained in:
Darragh Bailey
2012-10-16 17:19:37 +01:00
parent 05fac847a5
commit 45934b7b62
5 changed files with 120 additions and 7 deletions

14
README
View File

@@ -1,8 +1,8 @@
hpgit is a Python application providing a default workflow for HP Cloud
projects (i.e. feature branch creation/finishing, release starting/finishing)
on top of git. The operations are performed using Git commands.
hpgit is a Python application providing commands to support usage of git for
HP Cloud projects (i.e. feature branch creation/finishing, release
starting/finishing). The operations are performed using Git commands.
hpgit can use multiple configuration files to specify project, team and
individual preferences when working on projects. This allows for a number of
similar but slightly different workflows to be implemented, while being
described by the same commands.
hpgit is intended to make use of multiple configuration files to specify
project, team and individual preferences. This allows for variations in similar
workflows to be supported, without needing developers from different projects
to be aware of the specific operations need for other projects.

0
ghp/__init__.py Normal file
View File

52
ghp/version.py Normal file
View File

@@ -0,0 +1,52 @@
#
# Copyright (c) 2012 Hewlett-Packard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
import os
import shlex
import subprocess
def run_command(cmd, status=False, env={}):
if VERBOSE:
print(datetime.datetime.now(), "Running:", cmd)
cmd_list = shlex.split(str(cmd))
newenv = os.environ
newenv.update(env)
p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, env=newenv)
(out, nothing) = p.communicate()
out = out.decode('utf-8')
if status:
return (p.returncode, out.strip())
return out.strip()
def git_describe_version():
try:
v = run_command('git describe --tags --dirty')
except RuntimeException, e:
pass
return v
def get_version():
try:
return git_describe_version()
except:
pass
return 'unknown-version'
version = get_version()

17
git-hp Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python
#
# Copyright (c) 2012 Hewlett-Packard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

44
setup.py Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env python
#
# Copyright (c) 2012 Hewlett-Packard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from setuptools import setup, find_packages
from ghp import version
# taken from setuptools example.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "hpgit",
version = version.version,
author = "Darragh Bailey",
author_email = "dbailey@hp.com",
description = ("Tool supporting HPCloud git workflows."),
license = "Apache License (2.0)",
keywords = "git hpcloud workflow",
url = "https://wiki.hpcloud.net/display/auto/hpgit",
scripts = ['git-hp'],
packages = find_packages(exclude=['test']),
long_description=read('README'),
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: Apache License",
],
)