File tree Expand file tree Collapse file tree 5 files changed +24
-13
lines changed Expand file tree Collapse file tree 5 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# coding=utf-8
3+ from mailjet_rest .client import Client
4+ from mailjet_rest .utils .version import get_version
35
4- from . client import Client
6+ __version__ = get_version ()
57
6- from ._version import __version__
7- __all__ = (Client ,)
8+ __all__ = (Client , get_version )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66
77import requests
88from requests .compat import urljoin
9- from ._version import __version__
9+ from .utils . version import get_version
1010
1111requests .packages .urllib3 .disable_warnings ()
1212
@@ -15,7 +15,7 @@ class Config(object):
1515 API_URL = 'https://api.mailjet.com/'
1616 API_REF = 'http://dev.mailjet.com/email-api/v3/'
1717 version = 'v3'
18- user_agent = 'mailjet-apiv3-python/' + __version__
18+ user_agent = 'mailjet-apiv3-python/' + get_version ()
1919
2020 def __init__ (self , version = None ):
2121 if version is not None :
Original file line number Diff line number Diff line change 1+ VERSION = (1 , 3 , 0 )
2+
3+
4+ def get_version (version = None ):
5+ '''
6+ Calculate package version based on a 3 item tuple.
7+ In addition verify that the tuple contains 3 items
8+ '''
9+ if version is None :
10+ version = VERSION
11+ else :
12+ assert len (version ) == 3
13+ return 'v{0}.{1}.{2}' .format (* (x for x in version ))
Original file line number Diff line number Diff line change 22# coding=utf-8
33
44import os
5- import re
65from setuptools import setup
76
87HERE = os .path .abspath (os .path .dirname (__file__ ))
98PACKAGE_NAME = 'mailjet_rest'
109
11- # Taken from https://stackoverflow.com/a/39671214/1506051
12- __version__ = re .search (
13- r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]' , # It excludes inline comment too
14- open ('mailjet_rest/_version.py' ).read ()).group (1 )
10+ import ipdb ; ipdb .set_trace ()
11+ # Dynamically calculate the version based on mailjet_rest.VERSION.
12+ version = __import__ ('mailjet_rest' ).get_version ()
1513
1614setup (
1715 name = PACKAGE_NAME ,
18- version = __version__ ,
16+ version = version ,
1917 author = 'starenka' ,
20182119 maintainer = 'Mailjet' ,
2220 maintainer_email = '[email protected] ' ,
23- download_url = 'https://github.com/mailjet/mailjet-apiv3-python/releases/tag/v' + __version__ ,
21+ download_url = 'https://github.com/mailjet/mailjet-apiv3-python/releases/tag/v' + version ,
2422 url = 'https://github.com/mailjet/mailjet-apiv3-python' ,
2523 description = ('Mailjet V3 API wrapper' ),
2624 classifiers = ['Development Status :: 3 - Alpha' ,
You can’t perform that action at this time.
0 commit comments