Initial hpgit python project
Initial files for the hpgit python project Change-Id: Iebd1f5aa789dcd9574a00bb8837e4596bf55fa88 JIRA: CICD-242
This commit is contained in:
14
README
14
README
@@ -1,8 +1,8 @@
|
|||||||
hpgit is a Python application providing a default workflow for HP Cloud
|
hpgit is a Python application providing commands to support usage of git for
|
||||||
projects (i.e. feature branch creation/finishing, release starting/finishing)
|
HP Cloud projects (i.e. feature branch creation/finishing, release
|
||||||
on top of git. The operations are performed using Git commands.
|
starting/finishing). The operations are performed using Git commands.
|
||||||
|
|
||||||
hpgit can use multiple configuration files to specify project, team and
|
hpgit is intended to make use of multiple configuration files to specify
|
||||||
individual preferences when working on projects. This allows for a number of
|
project, team and individual preferences. This allows for variations in similar
|
||||||
similar but slightly different workflows to be implemented, while being
|
workflows to be supported, without needing developers from different projects
|
||||||
described by the same commands.
|
to be aware of the specific operations need for other projects.
|
||||||
|
0
ghp/__init__.py
Normal file
0
ghp/__init__.py
Normal file
52
ghp/version.py
Normal file
52
ghp/version.py
Normal 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
17
git-hp
Executable 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
44
setup.py
Normal 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",
|
||||||
|
],
|
||||||
|
)
|
Reference in New Issue
Block a user