Skip to content

Commit 970d528

Browse files
author
Sharoon Thomas
committed
Merge branch 'release/3.2.0.2'
2 parents c2be7cd + 75fcfc6 commit 970d528

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

attachment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ def set_data(cls, attachments, name, value):
118118
])
119119
key = Key(bucket)
120120
key.key = filename
121-
key.set_contents_from_string(value)
121+
key.set_contents_from_string(value[:])
122122
else:
123123
key = Key(bucket)
124124
key.key = filename
125-
key.set_contents_from_string(value)
125+
key.set_contents_from_string(value[:])
126126
cls.write(attachments, {
127127
'digest': digest,
128128
'collision': collision,

setup.py

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,50 @@
11
#! /usr/bin/env python
2-
#This file is part of Tryton. The COPYRIGHT file at the top level of
3-
#this repository contains the full copyright notices and license terms.
2+
# This file is part of Tryton. The COPYRIGHT file at the top level of
3+
# this repository contains the full copyright notices and license terms.
44
import re
55
import os
6-
from setuptools import setup
6+
import sys
7+
from setuptools import setup, Command
78
import ConfigParser
9+
import unittest
810

911
requires = ['boto']
1012

1113

1214
def read(fname):
1315
return open(os.path.join(os.path.dirname(__file__), fname)).read()
1416

17+
18+
class SQLiteTest(Command):
19+
"""
20+
Run the tests on SQLite
21+
"""
22+
description = "Run tests on SQLite"
23+
24+
user_options = []
25+
26+
def initialize_options(self):
27+
pass
28+
29+
def finalize_options(self):
30+
pass
31+
32+
def run(self):
33+
if self.distribution.tests_require:
34+
self.distribution.fetch_build_eggs(self.distribution.tests_require)
35+
36+
from trytond.config import CONFIG
37+
CONFIG['db_type'] = 'sqlite'
38+
os.environ['DB_NAME'] = ':memory:'
39+
40+
from tests import suite
41+
test_result = unittest.TextTestRunner(verbosity=3).run(suite())
42+
43+
if test_result.wasSuccessful():
44+
sys.exit(0)
45+
sys.exit(-1)
46+
47+
1548
config = ConfigParser.ConfigParser()
1649
config.readfp(open('tryton.cfg'))
1750
info = dict(config.items('tryton'))
@@ -39,19 +72,20 @@ def read(fname):
3972
setup(
4073
name='trytond_attachment_s3',
4174
version=info.get('version', '0.0.1'),
42-
description=info.get('description', ''),
75+
description='Amazon S3 backend for Tryton Attachments',
4376
long_description=read('README.md'),
4477
author='Openlabs Technologies & Consulting (P) Limited',
4578
author_email=info.get('email', ''),
46-
url=info.get('website', ''),
79+
url='https://github.com/openlabs/trytond-attachment-s3',
4780
package_dir={'trytond.modules.attachment_s3': '.'},
4881
packages=[
4982
'trytond.modules.attachment_s3',
5083
'trytond.modules.attachment_s3.tests',
5184
],
5285
package_data={
53-
'trytond.modules.attachment_s3': info.get('xml', []) +
54-
['tryton.cfg', 'locale/*.po', '*.odt', 'icons/*.svg'],
86+
'trytond.modules.attachment_s3': info.get('xml', []) + [
87+
'tryton.cfg', 'locale/*.po', '*.odt', 'icons/*.svg'
88+
],
5589
},
5690
classifiers=[
5791
'Development Status :: 5 - Production/Stable',
@@ -73,4 +107,7 @@ def read(fname):
73107
""",
74108
test_suite='tests',
75109
test_loader='trytond.test_loader:Loader',
110+
cmdclass={
111+
'test': SQLiteTest,
112+
},
76113
)

tryton.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tryton]
2-
version=3.0.1.1
2+
version=3.2.0.2
33
depends:
44
ir

utils/upload_attachments_to_s3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ def upload(connection, bucket, data_path, database, new_db_name=None):
6363

6464
if __name__ == '__main__':
6565
parser = OptionParser(
66-
usage="usage: %prog [options]" +
66+
usage="usage: %prog [options]" + (
6767
" access_key secret_key bucket data_path db_name"
68+
)
6869
)
6970
parser.add_option("-n", "--new-db-name", dest="new_db_name",
7071
help="New database name to prefix to the files", default=None)

0 commit comments

Comments
 (0)