Skip to content
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

Added code improvements to setup.py #265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
53 changes: 30 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,62 @@
"""

import os
import sys
import re
from setuptools import setup

#function to find the version in gmv_cmd

# function to find the version in gmv_cmd
def find_version(path):
with open(path, 'r') as f:
with open(path) as f:
for line in f:
index = line.find('GMVAULT_VERSION = "')
if index > -1:
print(line[index+19:-2])
res = line[index+19:-2]
return res.strip()
match = re.match(r'GMVAULT_VERSION\s=\s"(?P<version>[\d.]+)"', line)
if match is not None:
version = match.groupdict().get('version')
return version

raise Exception("Cannot find GMVAULT_VERSION in %s\n" % path)

path = os.path.join(os.path.dirname(__file__), './src/gmv/gmvault_utils.py')
print("PATH = %s\n" % path)
top_dir = os.path.dirname(os.path.realpath(__file__))

version = find_version(os.path.join(os.path.dirname(__file__),
'./src/gmv/gmvault_utils.py'))
utils_path = os.path.join(top_dir, 'src/gmv/gmvault_utils.py')
print("PATH = %s\n" % utils_path)

print("Gmvault version = %s\n" % version)
README = os.path.join(os.path.dirname(__file__), './README.md')
if os.path.exists(README):
with open(README, 'r') as f:
long_description = f.read() + 'nn'
try:
version = find_version(utils_path)
except Exception as e:
print(str(e))
sys.exit(1)
else:
print("Gmvault version = %s\n" % version)

readme_path = os.path.join(top_dir, 'README.md')
try:
with open(readme_path) as f:
long_description = f.read() + '\n\n'
except IOError as e:
long_description = 'Gmvault'

setup(name='gmvault',
version=version,
description=("Tool to backup and restore your Gmail emails at will. http://www.gmvault.org for more info"),
long_description=long_description,
classifiers=[
"Programming Language :: Python",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Topic :: Communications :: Email",
"Topic :: Communications :: Email :: Post-Office :: IMAP",
],
"Programming Language :: Python",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Topic :: Communications :: Email",
"Topic :: Communications :: Email :: Post-Office :: IMAP",
],
keywords='gmail, email, backup, gmail backup, imap',
author='Guillaume Aubert',
author_email='[email protected]',
url='http://www.gmvault.org',
license='AGPLv3',
packages=['gmv','gmv.conf', 'gmv.conf.utils'],
packages=['gmv', 'gmv.conf', 'gmv.conf.utils'],
package_dir = {'gmv': './src/gmv'},
scripts=['./etc/scripts/gmvault'],
package_data={'': ['release-note.txt']},
include_package_data=True,
#install_requires=['argparse', 'Logbook==0.4.1', 'IMAPClient==0.9.2','gdata==2.0.17']
# install_requires=['argparse', 'Logbook==0.4.1', 'IMAPClient==0.9.2','gdata==2.0.17']
install_requires=['argparse', 'Logbook==0.10.1', 'IMAPClient==0.13', 'chardet==2.3.0']
)