Merge lp:~nataliabidart/magicicada-protocol/upload-to-pypi into lp:magicicada-protocol

Proposed by Natalia Bidart on 2018-04-08
Status: Merged
Approved by: Natalia Bidart on 2018-04-11
Approved revision: 179
Merged at revision: 171
Proposed branch: lp:~nataliabidart/magicicada-protocol/upload-to-pypi
Merge into: lp:magicicada-protocol
Prerequisite: lp:~nataliabidart/magicicada-protocol/update-copyright-headers
Diff against target: 362 lines (+129/-142)
12 files modified
.bzrignore (+1/-0)
.travis.yml (+13/-0)
Dockerfile (+14/-0)
Makefile (+62/-0)
README.windows (+0/-8)
requirements-devel.txt (+3/-0)
requirements.txt (+11/-0)
run-tests (+0/-36)
run-tests.bat (+0/-82)
setup.py (+24/-13)
ubuntuone.storageprotocol.pth (+0/-2)
ubuntuone/storageprotocol/tests/test_context.py (+1/-1)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-protocol/upload-to-pypi
Reviewer Review Type Date Requested Status
Facundo Batista 2018-04-08 Approve on 2018-04-11
Review via email: mp+342842@code.launchpad.net

Commit message

- Adapt setup.py so the project is buildable as wheel and available in Pypi (see https://pypi.org/project/ubuntuone-storageprotocol/).
- Added docker and travis files so test runs are executed on xenial envs and pass (see https://travis-ci.org/chicharreros/magicicada-protocol).

To post a comment you must log in.
178. By Natalia Bidart on 2018-04-08

More docker dependencies.

179. By Natalia Bidart on 2018-04-08

Merged update-copyright-headers into upload-to-pypi.

Facundo Batista (facundo) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2009-06-03 14:46:23 +0000
+++ .bzrignore 2018-04-08 19:49:23 +0000
@@ -8,3 +8,4 @@
8*.substvars8*.substvars
9*_pb2.py9*_pb2.py
10*.pyc10*.pyc
11*.egg-info
1112
=== added file '.travis.yml'
--- .travis.yml 1970-01-01 00:00:00 +0000
+++ .travis.yml 2018-04-08 19:49:23 +0000
@@ -0,0 +1,13 @@
1sudo: required
2dist: trusty
3language: bash
4
5services:
6 - docker
7
8before_install:
9 - docker pull ubuntu:16.04
10 - docker build -t magicicada-test-run .
11
12script:
13 - docker run magicicada-test-run make test
014
=== added file 'Dockerfile'
--- Dockerfile 1970-01-01 00:00:00 +0000
+++ Dockerfile 2018-04-08 19:49:23 +0000
@@ -0,0 +1,14 @@
1FROM ubuntu:16.04
2
3ADD . /home/ubuntu/magicicada
4COPY . /home/ubuntu/magicicada
5WORKDIR /home/ubuntu/magicicada
6
7RUN apt update && apt install make gcc python python-dev virtualenv protobuf-compiler -y --no-install-recommends
8RUN make bootstrap
9
10RUN useradd -ms /bin/bash ubuntu
11RUN chown -R ubuntu:ubuntu /home/ubuntu
12
13USER ubuntu
14ENV HOME /home/ubuntu
015
=== added file 'Makefile'
--- Makefile 1970-01-01 00:00:00 +0000
+++ Makefile 2018-04-08 19:49:23 +0000
@@ -0,0 +1,62 @@
1# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU Affero General Public License as
5# published by the Free Software Foundation, either version 3 of the
6# License, or (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU Affero General Public License for more details.
12#
13# You should have received a copy of the GNU Affero General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15#
16# For further info, check http://launchpad.net/magicicada-protocol
17
18ENV = $(CURDIR)/.env
19SRC_DIR = $(CURDIR)/ubuntuone
20PATH := $(ENV)/bin:$(PATH)
21PYTHON = $(ENV)/bin/python
22PYTHONPATH := $(ENV)/lib/python2.7:$(ENV)/lib/python2.7/site-packages:$(SRC_DIR):$(PYTHONPATH)
23
24# use protobuf cpp
25PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
26PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
27
28export PATH
29export PYTHONPATH
30
31$(ENV): $(ENV)/bin/activate
32
33# only runs when requirements.txt or requirements-devel.txt changes
34$(ENV)/bin/activate: requirements.txt requirements-devel.txt
35 test -d $(ENV) || virtualenv $(ENV)
36 $(ENV)/bin/pip install -Ur requirements.txt
37 $(ENV)/bin/pip install -Ur requirements-devel.txt
38 touch $(ENV)/bin/activate
39
40bootstrap: build
41
42build: $(ENV)
43 $(PYTHON) setup.py build
44
45bdist: build
46 $(PYTHON) setup.py bdist_wheel
47
48upload: bdist
49 $(ENV)/bin/twine upload dist/*.whl
50
51test: lint
52 SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(ENV)/bin/trial ubuntuone
53
54clean:
55 $(PYTHON) setup.py clean
56 find -name '*.pyc' -delete
57 rm -rf build dist sdist _trial_temp ubuntuone_storageprotocol.egg-info
58
59lint: $(ENV)
60 $(ENV)/bin/flake8 --filename='*.py' --exclude='$(ENV),*_pb2.py,build'
61
62.PHONY: build bdist upload test lint
063
=== removed file 'README.windows'
--- README.windows 2010-03-15 18:48:27 +0000
+++ README.windows 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1installation steps
2
3- install protoc
4- download protobuf and "python setup.py install" in protobuf\python
5- easy_install pyopenssl
6- easy_install bzr
7- install twisted
8- install
90
=== added file 'requirements-devel.txt'
--- requirements-devel.txt 1970-01-01 00:00:00 +0000
+++ requirements-devel.txt 2018-04-08 19:49:23 +0000
@@ -0,0 +1,3 @@
1flake8
2mocker
3twine
04
=== added file 'requirements.txt'
--- requirements.txt 1970-01-01 00:00:00 +0000
+++ requirements.txt 2018-04-08 19:49:23 +0000
@@ -0,0 +1,11 @@
1pyOpenSSL
2protobuf
3# From twisted UserWarning: You do not have a working installation of the
4# service_identity module: 'No module named service_identity'. Please install
5# it from <https://pypi.python.org/pypi/service_identity> and make sure all of
6# its dependencies are satisfied. Without the service_identity module, Twisted
7# can perform only rudimentary TLS client hostname verification. Many valid
8# certificate/hostname mappings may be rejected.
9service_identity
10twisted
11zope.interface
012
=== removed file 'run-tests'
--- run-tests 2018-04-08 19:36:31 +0000
+++ run-tests 1970-01-01 00:00:00 +0000
@@ -1,36 +0,0 @@
1#!/bin/bash
2#
3# Copyright 2010 Canonical Ltd.
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU Affero General Public License version 3,
7# as published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16set -e
17
18SYSNAME=`uname -s`
19
20PROTOC_VERSION_AS_INT=`protoc --version | cut -d' ' -f2 | awk -F. '{ print $ 1 * 1000 + $2 * 100 + $ 3; }'`
21
22/usr/bin/env python setup.py build
23# run the tests with pure python protobuf
24SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial ubuntuone/storageprotocol/tests
25if [ "$SYSNAME" != "Darwin" ]; then
26 # and with the cpp extension, for server (linux) only:
27 if [ $PROTOC_VERSION_AS_INT -lt 2500 ]; then
28 SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial ubuntuone/storageprotocol/tests
29 fi
30fi
31
32USE_PYFLAKES=1 u1lint
33/usr/bin/env python setup.py clean
34rm -rf build
35pep8 --repeat --ignore=E126,E127,E128 --exclude="*_pb2.py,.bzr,.pc,build" .
36rm -rf _trial_temp
370
=== removed file 'run-tests.bat'
--- run-tests.bat 2013-05-22 21:37:17 +0000
+++ run-tests.bat 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1:: Copyright 2012 Canonical Ltd.
2::
3:: This program is free software: you can redistribute it and/or modify it
4:: under the terms of the GNU General Public License version 3, as published
5:: by the Free Software Foundation.
6::
7:: This program is distributed in the hope that it will be useful, but
8:: WITHOUT ANY WARRANTY; without even the implied warranties of
9:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
10:: PURPOSE. See the GNU General Public License for more details.
11::
12:: You should have received a copy of the GNU General Public License along
13:: with this program. If not, see <http://www.gnu.org/licenses/>.
14
15@ECHO off
16
17SET MODULE="tests"
18SET PYTHONEXEPATH=""
19SET IGNORE_PATHS="ubuntuone\controlpanel\dbustests"
20SET IGNORE_MODULES="test_linux.py, test_darwin.py"
21SET PYTHONPATH=%PYTHONPATH%;..\ubuntu-sso-client;..\ubuntuone-dev-tools\;..\dirspec;.
22
23ECHO Checking for Python on the path
24:: Look for Python from buildout
25FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
26FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
27FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
28FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
29
30IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
31ECHO Please ensure you have python installed
32GOTO :END
33
34:PYTHONPRESENT
35
36:: throw the first parameter away if is /skip-lint,
37:: the way we do this is to ensure that /skip-lint
38:: is the first parameter and copy all the rest in a loop
39:: the main reason for that is that %* is not affected
40:: by SHIFT, that is, it allways have all passed parameters
41
42SET PARAMS=%*
43SET SKIPLINT=0
44IF "%1" == "/skip-lint" (
45 SET SKIPLINT=1
46 GOTO :CLEANPARAMS
47)ELSE (
48 GOTO :CONTINUEBATCH)
49:CLEANPARAMS
50
51SHIFT
52SET PARAMS=%1
53:GETREST
54SHIFT
55if [%1]==[] (
56 GOTO CONTINUEBATCH)
57SET PARAMS=%PARAMS% %1
58GOTO GETREST
59:CONTINUEBATCH
60
61
62"%PYTHONEXEPATH%" setup.py build
63ECHO Running tests
64:: execute the tests with a number of ignored linux only modules
65"%PYTHONEXEPATH%" "%TRIALPATH%" -p %IGNORE_PATHS% -i %IGNORE_MODULES% %PARAMS% %MODULE%
66
67:: Clean the build from the setup.py
68ECHO Cleaning the generated code
69"%PYTHONEXEPATH%" setup.py clean
70
71IF %SKIPLINT% == 1 GOTO :CLEAN
72ECHO Performing style checks...
73SET USE_PYFLAKES=1
74"%PYTHONEXEPATH%" "%LINTPATH%" "%MODULE%"
75"%PEP8PATH%" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py,*_pb2.py" --repeat .
76
77:CLEAN
78:: Delete the temp folders
79IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
80IF EXIST _trial_temp RMDIR /s /q _trial_temp
81:TRIALTEMPEXISTS
82IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /q "%TRIAL_TEMP_DIR%"
830
=== modified file 'setup.py' (properties changed: +x to -x)
--- setup.py 2016-09-19 02:00:32 +0000
+++ setup.py 2018-04-08 19:49:23 +0000
@@ -1,7 +1,7 @@
1#!/usr/bin/env python1# -*- coding: utf-8 -*-
2# setup.py - Build system for Ubuntu One Storage Protocol package
3#2#
4# Copyright 2009 Canonical Ltd.3# Copyright 2009 Canonical Ltd.
4# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
5#5#
6# This program is free software: you can redistribute it and/or modify it6# This program is free software: you can redistribute it and/or modify it
7# under the terms of the GNU Affero General Public License version 3,7# under the terms of the GNU Affero General Public License version 3,
@@ -21,9 +21,9 @@
21import sys21import sys
22import subprocess22import subprocess
2323
24from distutils.core import setup
25from distutils.spawn import find_executable24from distutils.spawn import find_executable
26from distutils.command import clean, build25from distutils.command import clean, build
26from setuptools import find_packages, setup
2727
2828
29class StorageProtocolBuild(build.build):29class StorageProtocolBuild(build.build):
@@ -58,19 +58,30 @@
5858
59 def run(self):59 def run(self):
60 """Do the clean up"""60 """Do the clean up"""
61 for source in \61 for source in glob.glob("ubuntuone/storageprotocol/*_pb2.py"):
62 glob.glob("ubuntuone/storageprotocol/*_pb2.py"):
63 os.unlink(source)62 os.unlink(source)
6463
65 # Call the parent class clean command64 # Call the parent class clean command
66 clean.clean.run(self)65 clean.clean.run(self)
6766
6867
69setup(name='ubuntuone-storage-protocol',68setup(
70 version='99.12',69 name='ubuntuone-storageprotocol',
71 packages=['ubuntuone',70 namespace_packages=['ubuntuone'],
72 'ubuntuone.storageprotocol'],71 version='0.9.3',
73 extra_path='ubuntuone-storage-protocol',72 description=(
74 cmdclass={'build': StorageProtocolBuild,73 'The protocol implementation for the Magicicada filesync server '
75 'clean': StorageProtocolClean},74 '(open source fork of the Ubuntu One filesync).'),
76 )75 # From twisted - UserWarning: You do not have a working installation of the
76 # service_identity module: 'No module named service_identity'. Please
77 # install it from <https://pypi.python.org/pypi/service_identity> and make
78 # sure all of its dependencies are satisfied. Without the service_identity
79 # module, Twisted can perform only rudimentary TLS client hostname
80 # verification. Many valid certificate/hostname mappings may be rejected.
81 install_requires=[
82 'pyOpenSSL', 'protobuf', 'service_identity', 'twisted',
83 'zope.interface'],
84 packages=find_packages(),
85 cmdclass={'build': StorageProtocolBuild,
86 'clean': StorageProtocolClean},
87)
7788
=== removed file 'ubuntuone.storageprotocol.pth'
--- ubuntuone.storageprotocol.pth 2011-02-07 22:57:54 +0000
+++ ubuntuone.storageprotocol.pth 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1ubuntuone-storage-protocol
2
30
=== modified file 'ubuntuone/storageprotocol/tests/test_context.py'
--- ubuntuone/storageprotocol/tests/test_context.py 2018-04-08 19:36:31 +0000
+++ ubuntuone/storageprotocol/tests/test_context.py 2018-04-08 19:49:23 +0000
@@ -132,7 +132,7 @@
132 d = self.verify_context(server_context, client_context)132 d = self.verify_context(server_context, client_context)
133 e = yield self.assertFailure(d, SSL.Error)133 e = yield self.assertFailure(d, SSL.Error)
134 self.assertEqual(len(e.message), 1)134 self.assertEqual(len(e.message), 1)
135 expected = ('SSL routines', 'ssl3_get_server_certificate',135 expected = ('SSL routines', 'tls_process_server_certificate',
136 'certificate verify failed')136 'certificate verify failed')
137 self.assertEqual(e.message[0], expected)137 self.assertEqual(e.message[0], expected)
138138

Subscribers

People subscribed via source and target branches

to all changes: