Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cctrl.egg-info/
dotcloudng.egg-info/
htmlcov/
.cache/
26 changes: 26 additions & 0 deletions cctrl/dcapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Copyright 2014 cloudControl GmbH

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.
"""

from cctrl.settings import Settings
from cctrl.app_commands import setup_cli


if __name__ == "__main__":
settings = Settings(api_url='https://api.dotcloudapp.com', ssh_forwarder_url='sshforwarder.dotcloudapp.com')
setup_cli(settings)
25 changes: 25 additions & 0 deletions cctrl/dcuser
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Copyright 2014 cloudControl GmbH

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.
"""
from cctrl.settings import Settings
from cctrl.user_commands import setup_cli


if __name__ == "__main__":
settings = Settings(api_url='https://api.dotcloudapp.com', ssh_forwarder_url='sshforwarder.dotcloudapp.com')
setup_cli(settings)
2 changes: 1 addition & 1 deletion cctrl/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '1.11.1'
__version__ = '1.12.0'
40 changes: 40 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Continous releasing
===================

This CI setup releases `cctrl` and `dotcloudng` packages on PyPI whenever a new bumped version
is pushed into master branch.

Requirements
------------

* Create a [PyPI account](https://pypi.python.org/pypi?%3Aaction=register_form) for jenkins user.
* Create `.pypirc` file at jenkins user's $HOME:

~~~
[distutils]
index-servers =
pypi

[pypi]
username:{Jenkins username at PyPI}
password:{Jenkins password at PyPI}
~~~

* Add _maintainer_ [role](https://pypi.python.org/pypi?:action=role_form&package_name=cctrl) in `cctrl` and `dotcloung` to jenkins user.

Build Configuration
-------------------

Build configuration is basic and similar to other jenkins builds. Furthermore,
_Execute shell_ is pretty simple:

ci/prepare
python ci/release.py

Double checking
---------------

When build is executed, you should find fresh new packages released under:

* `cctrl`: https://pypi.python.org/pypi/cctrl
* `dotcloudng`: https://pypi.python.org/pypi/dotcloudng
12 changes: 12 additions & 0 deletions ci/prepare
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e

echo "Install python tools..."
cd $WORKSPACE

if [ ! -d "cctrl_venv" ]; then
virtualenv --system-site-packages cctrl_venv
fi
source cctrl_venv/bin/activate
pip install -r requirements_tests.txt --upgrade

./pre-commit
43 changes: 43 additions & 0 deletions ci/release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python setup.py already provides the functionality, have a look: https://docs.python.org/2/distutils/packageindex.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scripts indeed uses setup.py.

I'm going nuts, but yesterday I read the official documentation recommending to use twine as a recommended replacement of setup.py upload. Now I can't find it. Still, in the package itself states why twine is better than setup.py upload https://pypi.python.org/pypi/twine

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After taking a look, I think I can change it back to a plane setup.py upload, instead of using third party packages.

The motivation of having a script instead of directly calling the setup.py command is that this way we can check the version and only upload when it is newer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end, as you prefer. I just know that pypi renewed their package system and I know this register/upload command from that time. If a script fits better for us, fine with me, just want to mention it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

import sys
import xmlrpclib

from shutil import rmtree
from subprocess import check_call

TEMP_DIR = 'tmp'
PROJECT_NAME = 'cctrl'
DIST_DIR = os.path.join(TEMP_DIR, 'dist')


def main():
if is_current_version():
sys.exit("Version is not updated. Aborting release.")

dist()
cleanup()


def is_current_version():
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
return pypi.package_releases('cctrl')[0] == __version__


def dist():
try:
check_call(['python',
'setup.py',
'sdist',
'--dist-dir={0}'.format(DIST_DIR),
'--formats=gztar',
'upload'])
except OSError as e:
print e


def cleanup():
rmtree(TEMP_DIR)

if __name__ == '__main__':
execfile(os.path.join(PROJECT_NAME, 'version.py'))
main()
29 changes: 28 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
required.append('pycclib>=1.5.2')
required.append('argparse>=1.1')

srcscripts = ['cctrl/cctrlapp', 'cctrl/cctrluser', 'cctrl/exoapp', 'cctrl/exouser']
srcscripts = ['cctrl/cctrlapp', 'cctrl/cctrluser', 'cctrl/exoapp', 'cctrl/exouser', 'cctrl/dcapp', 'cctrl/dcuser']

if sys.platform == 'win32':
import py2exe
Expand Down Expand Up @@ -95,3 +95,30 @@
test_suite='test',
**extra_options
)

setup(
name="dotcloudng",
version=__version__,
description='dotcloud command line utilities',
author='dotcloud Team',
author_email='info@dotcloud.com',
url='https://www.dotcloud.com',
license='Apache 2.0',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Internet'
],
install_requires=required,
tests_require=['mock'],
test_suite='test',
**extra_options
)
26 changes: 26 additions & 0 deletions win32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Building cloudControl CLI Windows installer
============================

### PRE-INSTALLATION STEPS

1. Install python 2.7.6 via msi installer: [http://www.python.org/download/releases/2.7.6/](http://www.python.org/download/releases/2.7.6/)
2. Install setuptools: [https://bitbucket.org/pypa/setuptools#rst-header-windows](https://bitbucket.org/pypa/setuptools#rst-header-windows)
3. Install pycrypto for python 2.7: [http://www.voidspace.org.uk/python/modules.shtml#pycrypto](http://www.voidspace.org.uk/python/modules.shtml#pycrypto)
4. Install p2exe: [http://sourceforge.net/projects/py2exe](http://sourceforge.net/projects/py2exe)
5. Install Inno Setup: [http://www.jrsoftware.org/isdl.php#stable](http://www.jrsoftware.org/isdl.php#stable)
6. Install git bash: [http://msysgit.github.io/](http://msysgit.github.io/)

### BUILDING CLI FOR SPECIFIC ENVIRONMENT

* To start build, simply execute (use git bash):

~~~bash
$ win32/build_installer.sh ENV PATH_TO_CCTRL_DIR
~~~

where:

- `ENV` is `[cctrl|dotcloudng]`
- `PATH_TO_CCTRL_DIR` is an optional parameter specifying path to cctrl source directory. If not specified build script will clone master version.

Optionally, you can specify locations of `Python` and `ISCC` home directories by setting these env variables: `PYTHON_HOME` and `ISCC_HOME`. After successful build, executable file is located in `win32setup` directory.
59 changes: 0 additions & 59 deletions win32/build_host_dependencies.txt

This file was deleted.

18 changes: 5 additions & 13 deletions win32/build_installer.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/bin/bash

# Script for building cloudControl CLI Windows installer

# Preparation steps:
# Install python 2.7.6 via msi installer: http://www.python.org/download/releases/2.7.6/
# Install setuptool: https://bitbucket.org/pypa/setuptools#rst-header-windows
# Install pycrypto for python 2.7: http://www.voidspace.org.uk/python/modules.shtml#pycrypto
# Install p2exe: http://sourceforge.net/projects/py2exe
# Install Inno Setup: http://www.jrsoftware.org/isdl.php#stable

set -e

echo "[INFO] Checking env..."
ENV=$1

if [ ! -f "$PYTHON_HOME" ]; then
PYTHON_HOME=c:/Python27
Expand Down Expand Up @@ -46,18 +38,18 @@ pushd pycclib > /dev/null
popd > /dev/null

echo "[INFO] Installing cctrl..."
if [ ! -d "$1" ]; then
if [ ! -d "$2" ]; then
git clone https://github.com/cloudControl/cctrl 2>&1 | handle_log
cctrl_dir=cctrl
else
cctrl_dir="$1"
cctrl_dir="$2"
fi

pushd "$cctrl_dir" > /dev/null
"$PYTHON_HOME/python.exe" setup.py py2exe 2>&1 | handle_log
pushd win32 > /dev/null
echo "[INFO] Building executable..."
"$ISCC_HOME/ISCC.exe" wininstaller.iss 2>&1 | handle_log
"$ISCC_HOME/ISCC.exe" wininstaller_$ENV.iss 2>&1 | handle_log
popd > /dev/null
popd > /dev/null
echo "[INFO] Build successful :-)"
echo "[INFO] Build successful :-)"
4 changes: 2 additions & 2 deletions win32/wininstaller.iss → win32/wininstaller_cctrl.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{86DDE49A-CB27-4B64-A816-887A13C06D58}
AppName=cctrl
AppVerName=cctrl-1.11.1
AppVerName=cctrl-1.12.0
AppPublisher=cloudControl GmbH
AppPublisherURL=https://www.cloudcontrol.com
AppSupportURL=https://www.cloudcontrol.com
Expand All @@ -17,7 +17,7 @@ DefaultGroupName=cloudControl
AllowNoIcons=yes
SourceDir=..\
OutputDir=win32setup
OutputBaseFilename=cctrl-1.11.1-setup
OutputBaseFilename=cctrl-1.12.0-setup
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes
Expand Down
Loading