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

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
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 Approve
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

More docker dependencies.

179. By Natalia Bidart

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

Revision history for this message
Facundo Batista (facundo) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-06-03 14:46:23 +0000
3+++ .bzrignore 2018-04-08 19:49:23 +0000
4@@ -8,3 +8,4 @@
5 *.substvars
6 *_pb2.py
7 *.pyc
8+*.egg-info
9
10=== added file '.travis.yml'
11--- .travis.yml 1970-01-01 00:00:00 +0000
12+++ .travis.yml 2018-04-08 19:49:23 +0000
13@@ -0,0 +1,13 @@
14+sudo: required
15+dist: trusty
16+language: bash
17+
18+services:
19+ - docker
20+
21+before_install:
22+ - docker pull ubuntu:16.04
23+ - docker build -t magicicada-test-run .
24+
25+script:
26+ - docker run magicicada-test-run make test
27
28=== added file 'Dockerfile'
29--- Dockerfile 1970-01-01 00:00:00 +0000
30+++ Dockerfile 2018-04-08 19:49:23 +0000
31@@ -0,0 +1,14 @@
32+FROM ubuntu:16.04
33+
34+ADD . /home/ubuntu/magicicada
35+COPY . /home/ubuntu/magicicada
36+WORKDIR /home/ubuntu/magicicada
37+
38+RUN apt update && apt install make gcc python python-dev virtualenv protobuf-compiler -y --no-install-recommends
39+RUN make bootstrap
40+
41+RUN useradd -ms /bin/bash ubuntu
42+RUN chown -R ubuntu:ubuntu /home/ubuntu
43+
44+USER ubuntu
45+ENV HOME /home/ubuntu
46
47=== added file 'Makefile'
48--- Makefile 1970-01-01 00:00:00 +0000
49+++ Makefile 2018-04-08 19:49:23 +0000
50@@ -0,0 +1,62 @@
51+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
52+#
53+# This program is free software: you can redistribute it and/or modify
54+# it under the terms of the GNU Affero General Public License as
55+# published by the Free Software Foundation, either version 3 of the
56+# License, or (at your option) any later version.
57+#
58+# This program is distributed in the hope that it will be useful,
59+# but WITHOUT ANY WARRANTY; without even the implied warranty of
60+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+# GNU Affero General Public License for more details.
62+#
63+# You should have received a copy of the GNU Affero General Public License
64+# along with this program. If not, see <http://www.gnu.org/licenses/>.
65+#
66+# For further info, check http://launchpad.net/magicicada-protocol
67+
68+ENV = $(CURDIR)/.env
69+SRC_DIR = $(CURDIR)/ubuntuone
70+PATH := $(ENV)/bin:$(PATH)
71+PYTHON = $(ENV)/bin/python
72+PYTHONPATH := $(ENV)/lib/python2.7:$(ENV)/lib/python2.7/site-packages:$(SRC_DIR):$(PYTHONPATH)
73+
74+# use protobuf cpp
75+PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
76+PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
77+
78+export PATH
79+export PYTHONPATH
80+
81+$(ENV): $(ENV)/bin/activate
82+
83+# only runs when requirements.txt or requirements-devel.txt changes
84+$(ENV)/bin/activate: requirements.txt requirements-devel.txt
85+ test -d $(ENV) || virtualenv $(ENV)
86+ $(ENV)/bin/pip install -Ur requirements.txt
87+ $(ENV)/bin/pip install -Ur requirements-devel.txt
88+ touch $(ENV)/bin/activate
89+
90+bootstrap: build
91+
92+build: $(ENV)
93+ $(PYTHON) setup.py build
94+
95+bdist: build
96+ $(PYTHON) setup.py bdist_wheel
97+
98+upload: bdist
99+ $(ENV)/bin/twine upload dist/*.whl
100+
101+test: lint
102+ SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(ENV)/bin/trial ubuntuone
103+
104+clean:
105+ $(PYTHON) setup.py clean
106+ find -name '*.pyc' -delete
107+ rm -rf build dist sdist _trial_temp ubuntuone_storageprotocol.egg-info
108+
109+lint: $(ENV)
110+ $(ENV)/bin/flake8 --filename='*.py' --exclude='$(ENV),*_pb2.py,build'
111+
112+.PHONY: build bdist upload test lint
113
114=== removed file 'README.windows'
115--- README.windows 2010-03-15 18:48:27 +0000
116+++ README.windows 1970-01-01 00:00:00 +0000
117@@ -1,8 +0,0 @@
118-installation steps
119-
120-- install protoc
121-- download protobuf and "python setup.py install" in protobuf\python
122-- easy_install pyopenssl
123-- easy_install bzr
124-- install twisted
125-- install
126
127=== added file 'requirements-devel.txt'
128--- requirements-devel.txt 1970-01-01 00:00:00 +0000
129+++ requirements-devel.txt 2018-04-08 19:49:23 +0000
130@@ -0,0 +1,3 @@
131+flake8
132+mocker
133+twine
134
135=== added file 'requirements.txt'
136--- requirements.txt 1970-01-01 00:00:00 +0000
137+++ requirements.txt 2018-04-08 19:49:23 +0000
138@@ -0,0 +1,11 @@
139+pyOpenSSL
140+protobuf
141+# From twisted UserWarning: You do not have a working installation of the
142+# service_identity module: 'No module named service_identity'. Please install
143+# it from <https://pypi.python.org/pypi/service_identity> and make sure all of
144+# its dependencies are satisfied. Without the service_identity module, Twisted
145+# can perform only rudimentary TLS client hostname verification. Many valid
146+# certificate/hostname mappings may be rejected.
147+service_identity
148+twisted
149+zope.interface
150
151=== removed file 'run-tests'
152--- run-tests 2018-04-08 19:36:31 +0000
153+++ run-tests 1970-01-01 00:00:00 +0000
154@@ -1,36 +0,0 @@
155-#!/bin/bash
156-#
157-# Copyright 2010 Canonical Ltd.
158-#
159-# This program is free software: you can redistribute it and/or modify it
160-# under the terms of the GNU Affero General Public License version 3,
161-# as published by the Free Software Foundation.
162-#
163-# This program is distributed in the hope that it will be useful, but
164-# WITHOUT ANY WARRANTY; without even the implied warranties of
165-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
166-# PURPOSE. See the GNU Affero General Public License for more details.
167-#
168-# You should have received a copy of the GNU Affero General Public License
169-# along with this program. If not, see <http://www.gnu.org/licenses/>.
170-set -e
171-
172-SYSNAME=`uname -s`
173-
174-PROTOC_VERSION_AS_INT=`protoc --version | cut -d' ' -f2 | awk -F. '{ print $ 1 * 1000 + $2 * 100 + $ 3; }'`
175-
176-/usr/bin/env python setup.py build
177-# run the tests with pure python protobuf
178-SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial ubuntuone/storageprotocol/tests
179-if [ "$SYSNAME" != "Darwin" ]; then
180- # and with the cpp extension, for server (linux) only:
181- if [ $PROTOC_VERSION_AS_INT -lt 2500 ]; then
182- SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial ubuntuone/storageprotocol/tests
183- fi
184-fi
185-
186-USE_PYFLAKES=1 u1lint
187-/usr/bin/env python setup.py clean
188-rm -rf build
189-pep8 --repeat --ignore=E126,E127,E128 --exclude="*_pb2.py,.bzr,.pc,build" .
190-rm -rf _trial_temp
191
192=== removed file 'run-tests.bat'
193--- run-tests.bat 2013-05-22 21:37:17 +0000
194+++ run-tests.bat 1970-01-01 00:00:00 +0000
195@@ -1,82 +0,0 @@
196-:: Copyright 2012 Canonical Ltd.
197-::
198-:: This program is free software: you can redistribute it and/or modify it
199-:: under the terms of the GNU General Public License version 3, as published
200-:: by the Free Software Foundation.
201-::
202-:: This program is distributed in the hope that it will be useful, but
203-:: WITHOUT ANY WARRANTY; without even the implied warranties of
204-:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
205-:: PURPOSE. See the GNU General Public License for more details.
206-::
207-:: You should have received a copy of the GNU General Public License along
208-:: with this program. If not, see <http://www.gnu.org/licenses/>.
209-
210-@ECHO off
211-
212-SET MODULE="tests"
213-SET PYTHONEXEPATH=""
214-SET IGNORE_PATHS="ubuntuone\controlpanel\dbustests"
215-SET IGNORE_MODULES="test_linux.py, test_darwin.py"
216-SET PYTHONPATH=%PYTHONPATH%;..\ubuntu-sso-client;..\ubuntuone-dev-tools\;..\dirspec;.
217-
218-ECHO Checking for Python on the path
219-:: Look for Python from buildout
220-FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
221-FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
222-FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
223-FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
224-
225-IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
226-ECHO Please ensure you have python installed
227-GOTO :END
228-
229-:PYTHONPRESENT
230-
231-:: throw the first parameter away if is /skip-lint,
232-:: the way we do this is to ensure that /skip-lint
233-:: is the first parameter and copy all the rest in a loop
234-:: the main reason for that is that %* is not affected
235-:: by SHIFT, that is, it allways have all passed parameters
236-
237-SET PARAMS=%*
238-SET SKIPLINT=0
239-IF "%1" == "/skip-lint" (
240- SET SKIPLINT=1
241- GOTO :CLEANPARAMS
242-)ELSE (
243- GOTO :CONTINUEBATCH)
244-:CLEANPARAMS
245-
246-SHIFT
247-SET PARAMS=%1
248-:GETREST
249-SHIFT
250-if [%1]==[] (
251- GOTO CONTINUEBATCH)
252-SET PARAMS=%PARAMS% %1
253-GOTO GETREST
254-:CONTINUEBATCH
255-
256-
257-"%PYTHONEXEPATH%" setup.py build
258-ECHO Running tests
259-:: execute the tests with a number of ignored linux only modules
260-"%PYTHONEXEPATH%" "%TRIALPATH%" -p %IGNORE_PATHS% -i %IGNORE_MODULES% %PARAMS% %MODULE%
261-
262-:: Clean the build from the setup.py
263-ECHO Cleaning the generated code
264-"%PYTHONEXEPATH%" setup.py clean
265-
266-IF %SKIPLINT% == 1 GOTO :CLEAN
267-ECHO Performing style checks...
268-SET USE_PYFLAKES=1
269-"%PYTHONEXEPATH%" "%LINTPATH%" "%MODULE%"
270-"%PEP8PATH%" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py,*_pb2.py" --repeat .
271-
272-:CLEAN
273-:: Delete the temp folders
274-IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
275-IF EXIST _trial_temp RMDIR /s /q _trial_temp
276-:TRIALTEMPEXISTS
277-IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /q "%TRIAL_TEMP_DIR%"
278
279=== modified file 'setup.py' (properties changed: +x to -x)
280--- setup.py 2016-09-19 02:00:32 +0000
281+++ setup.py 2018-04-08 19:49:23 +0000
282@@ -1,7 +1,7 @@
283-#!/usr/bin/env python
284-# setup.py - Build system for Ubuntu One Storage Protocol package
285+# -*- coding: utf-8 -*-
286 #
287 # Copyright 2009 Canonical Ltd.
288+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
289 #
290 # This program is free software: you can redistribute it and/or modify it
291 # under the terms of the GNU Affero General Public License version 3,
292@@ -21,9 +21,9 @@
293 import sys
294 import subprocess
295
296-from distutils.core import setup
297 from distutils.spawn import find_executable
298 from distutils.command import clean, build
299+from setuptools import find_packages, setup
300
301
302 class StorageProtocolBuild(build.build):
303@@ -58,19 +58,30 @@
304
305 def run(self):
306 """Do the clean up"""
307- for source in \
308- glob.glob("ubuntuone/storageprotocol/*_pb2.py"):
309+ for source in glob.glob("ubuntuone/storageprotocol/*_pb2.py"):
310 os.unlink(source)
311
312 # Call the parent class clean command
313 clean.clean.run(self)
314
315
316-setup(name='ubuntuone-storage-protocol',
317- version='99.12',
318- packages=['ubuntuone',
319- 'ubuntuone.storageprotocol'],
320- extra_path='ubuntuone-storage-protocol',
321- cmdclass={'build': StorageProtocolBuild,
322- 'clean': StorageProtocolClean},
323- )
324+setup(
325+ name='ubuntuone-storageprotocol',
326+ namespace_packages=['ubuntuone'],
327+ version='0.9.3',
328+ description=(
329+ 'The protocol implementation for the Magicicada filesync server '
330+ '(open source fork of the Ubuntu One filesync).'),
331+ # From twisted - UserWarning: You do not have a working installation of the
332+ # service_identity module: 'No module named service_identity'. Please
333+ # install it from <https://pypi.python.org/pypi/service_identity> and make
334+ # sure all of its dependencies are satisfied. Without the service_identity
335+ # module, Twisted can perform only rudimentary TLS client hostname
336+ # verification. Many valid certificate/hostname mappings may be rejected.
337+ install_requires=[
338+ 'pyOpenSSL', 'protobuf', 'service_identity', 'twisted',
339+ 'zope.interface'],
340+ packages=find_packages(),
341+ cmdclass={'build': StorageProtocolBuild,
342+ 'clean': StorageProtocolClean},
343+)
344
345=== removed file 'ubuntuone.storageprotocol.pth'
346--- ubuntuone.storageprotocol.pth 2011-02-07 22:57:54 +0000
347+++ ubuntuone.storageprotocol.pth 1970-01-01 00:00:00 +0000
348@@ -1,2 +0,0 @@
349-ubuntuone-storage-protocol
350-
351
352=== modified file 'ubuntuone/storageprotocol/tests/test_context.py'
353--- ubuntuone/storageprotocol/tests/test_context.py 2018-04-08 19:36:31 +0000
354+++ ubuntuone/storageprotocol/tests/test_context.py 2018-04-08 19:49:23 +0000
355@@ -132,7 +132,7 @@
356 d = self.verify_context(server_context, client_context)
357 e = yield self.assertFailure(d, SSL.Error)
358 self.assertEqual(len(e.message), 1)
359- expected = ('SSL routines', 'ssl3_get_server_certificate',
360+ expected = ('SSL routines', 'tls_process_server_certificate',
361 'certificate verify failed')
362 self.assertEqual(e.message[0], expected)
363

Subscribers

People subscribed via source and target branches

to all changes: