8000 fix setup lost some packages by find_packages by lihsai0 · Pull Request #438 · qiniu/python-sdk · GitHub
[go: up one dir, main page]

Skip to content
10000

fix setup lost some packages by find_packages #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 7.11.1(2023-08-16)
* 修复 setup.py 打包丢失部分包(v7.11.0 引入)

## 7.11.0(2023-03-28)
* 对象存储,更新 api 默认域名
* 对象存储,新增 api 域名的配置与获取
Expand Down
2 changes: 1 addition & 1 deletion qiniu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# flake8: noqa

__version__ = '7.11.0'
__version__ = '7.11.1'

from .auth import Auth, QiniuMacAuth

Expand Down
21 changes: 2 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@
import os
import re

try:
import setuptools

setup = setuptools.setup
except ImportError:
setuptools = None
from distutils.core import setup

packages = [
'qiniu',
'qiniu.services',
'qiniu.services.storage',
'qiniu.services.processing',
'qiniu.services.compute',
'qiniu.services.cdn',
'qiniu.services.sms',
'qiniu.services.pili',
]
from setuptools import setup, find_packages


def read(*names, **kwargs):
Expand Down Expand Up @@ -52,7 +35,7 @@ def find_version(*file_paths):
license='MIT',
url='https://github.com/qiniu/python-sdk',
platforms='any',
packages=packages,
packages=find_packages(),
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
Expand Down
44 changes: 22 additions & 22 deletions test_qiniu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
build_batch_delete, DomainManager
from qiniu import urlsafe_base64_encode, urlsafe_base64_decode, canonical_mime_header_key

from qiniu.compat import is_py2, is_py3, b
from qiniu.compat import is_py2, is_py3, b, json

from qiniu.services.storage.uploader import _form_put

Expand Down Expand Up @@ -414,7 +414,7 @@ def test_list(self):
assert len(ret.get('items')) == 4
ret, eof, info = self.bucket.list(bucket_name, limit=1000)
print(ret, eof, info)
assert eof is False
assert info.status_code == 200

def test_buckets(self):
ret, info = self.bucket.buckets()
Expand Down Expand Up @@ -699,14 +699,26 @@ def test_putWithoutKey(self):
assert info.status_code == 403 # key not match

def test_withoutRead_withoutSeek_retry(self):
key = 'retry'
data = 'hello retry!'
set_default(default_zone=Zone('http://a', 'https://upload.qiniup.com'))
token = self.q.upload_token(bucket_name)
ret, info = put_data(token, key, data)
print(info)
assert ret['key'] == key
assert ret['hash'] == 'FlYu0iBR1WpvYi4whKXiBuQpyLLk'
try:
key = 'retry'
data = 'hello retry!'
zone = Zone()
try:
hosts = json.loads(
zone.bucket_hosts(access_key, bucket_name)
).get('hosts')
up_host_backup = 'https://' + hosts[0].get('up', {}).get('domains')[0]
except IndexError:
up_host_backup = 'https://upload.qiniup.com'
set_default(default_zone=Zone('http://a', up_host_backup))
token = self.q.upload_token(bucket_name)
ret, info = put_data(token, key, data)
print(info)
assert ret['key'] == key
assert ret['hash'] == 'FlYu0iBR1WpvYi4whKXiBuQpyLLk'
finally:
set_default(default_zone=Zone())
qiniu.config._is_customized_default['default_zone'] = False

def test_putData_without_fname(self):
if is_travis():
Expand Down Expand Up @@ -780,7 +792,6 @@ def test_put_stream(self):
localfile = __file__
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(__file__), size, hostscache_dir,
Expand All @@ -792,7 +803,6 @@ def test_put_stream_v2_without_bucket_name(self):
localfile = __file__
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(__file__), size, hostscache_dir,
Expand All @@ -804,7 +814,6 @@ def test_put_2m_stream_v2(self):
localfile = create_temp_file(2 * 1024 * 1024 + 1)
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand All @@ -817,7 +826,6 @@ def test_put_4m_stream_v2(self):
localfile = create_temp_file(4 * 1024 * 1024)
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand All @@ -830,7 +838,6 @@ def test_put_10m_stream_v2(self):
localfile = create_temp_file(10 * 1024 * 1024 + 1)
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand All @@ -844,7 +851,6 @@ def test_put_stream_v2_without_key(self):
localfile = create_temp_file(part_size + 1)
key = None
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand All @@ -858,7 +864,6 @@ def test_put_stream_v2_with_empty_return_body(self):
localfile = create_temp_file(part_size + 1)
key = 'test_file_empty_return_body'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key, policy={'returnBody': ' '})
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand All @@ -873,7 +878,6 @@ def test_big_file(self):
token = self.q.upload_token(bucket_name, key)
localfile = create_temp_file(4 * 1024 * 1024 + 1)
progress_handler = lambda progress, total: progress
qiniu.set_default(default_zone=Zone('http://a', 'https://upload.qiniup.com'))
ret, info = put_file(token, key, localfile, self.params, self.mime_type, progress_handler=progress_handler)
print(info)
assert ret['key'] == key
Expand All @@ -882,7 +886,6 @@ def test_big_file(self):
def test_retry(self):
localfile = __file__
key = 'test_file_r_retry'
qiniu.set_default(default_zone=Zone('http://a', 'https://upload.qiniup.com'))
token = self.q.upload_token(bucket_name, key)
ret, info = put_file(token, key, localfile, self.params, self.mime_type)
print(info)
Expand All @@ -893,7 +896,6 @@ def test_put_stream_with_key_limits(self):
localfile = __file__
key = 'test_file_r'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key, policy={'keylimit': ['test_file_d']})
ret, info = put_stream(token, key, input_stream, os.path.basename(__file__), size, hostscache_dir,
Expand All @@ -910,7 +912,6 @@ def test_put_stream_with_metadata(self):
localfile = __file__
key = 'test_put_stream_with_metadata'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(__file__), size, hostscache_dir,
Expand All @@ -927,7 +928,6 @@ def test_put_stream_v2_with_metadata(self):
localfile = create_temp_file(part_size + 1)
key = 'test_put_stream_v2_with_metadata'
size = os.stat(localfile).st_size
set_default(default_zone=Zone('https://upload.qiniup.com'))
with open(localfile, 'rb') as input_stream:
token = self.q.upload_token(bucket_name, key)
ret, info = put_stream(token, key, input_stream, os.path.basename(localfile), size, hostscache_dir,
Expand Down
0