mirror of
https://github.com/OfflineIMAP/offlineimap3.git
synced 2025-12-14 20:35:43 +01:00
This patch includes a lot of changes: 1. Split the `requirements.txt` file in multiple files. This change holds the required packages for OfflineIMAP in the `requirements.txt` file. The optional packages are included in the files `requirements-option.txt` files. Now the standard OfflineIMAP configuration does not include packages like `cygwin`. See for example issue #192. 2. The `setup.py` process includes a lot of files (see issue #110). This creates a problem in the setup process, because some libraries are not found (see #39, the problem still happends). For this reason we can read the variables from the `offlineimap/__init__py` to include them in the `setup.py` script, without import the `offlineimap` module. I used the method presented at `https://www.youtube.com/watch?v=fHNhhHMUW7k`. In the setup module we don't need the testing code (it creates the import problem too), so this code is removed. To read the variables, we use some regex search in the `offlineimap/__init__py` file, save the values as variables, and then use them in the `setup()` call. 3. `setup.py` uses requires and extra_requires libraries, aligned with the `requirements` files. We use four different options: `kerberos`, `keyring`, `cygwin`, `cygwin` and `testinternet`. 4. `pyproject.toml`. This file is fully rewritten. The file use now the right dependencies, includes the optional dependencies aligned with the requirements and the `setup.py` files. The file include other details, like classifiers, URLs,... This script uses now the the `project.scripts` option, with the module and the method to call when the setup file is created. Then, this script includes as module `offlineimap.init`, and the startup method is `main`. Because this method is new, this method and the `__main__` functions are created in the `offlineimap/init.py` file: ```python def main(): oi = OfflineImap() oi.run() if __name__ == "__main__": main() ``` With these changes, the setup process works fine, with and without optional modules. Finally, the folder `offlineimap.egg-info`, created in the setup process is included in the `.gitignore` file. It is possible check the creation using: ```python python -m pip install . ``` And then use the command `offilineimap` to use the module. Finally, the `bin/offlineimap` command is not used, so we probably can remove it. Fix: #192, Fix: #110, Fix: #39, Fix: #90
97 lines
3.1 KiB
Python
97 lines
3.1 KiB
Python
#!/usr/bin/env python
|
|
|
|
# $Id: setup.py,v 1.1 2002/06/21 18:10:49 jgoerzen Exp $
|
|
|
|
# IMAP synchronization
|
|
# Module: installer
|
|
# COPYRIGHT #
|
|
# Copyright (C) 2002 - 2018 John Goerzen & contributors
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
import re
|
|
try:
|
|
from setuptools import setup, Command
|
|
except:
|
|
from distutils.core import setup, Command
|
|
|
|
|
|
with open('offlineimap/__init__.py') as f:
|
|
version_grp = re.search(r"__version__ = ['\"](.+)['\"]", f.read())
|
|
if version_grp:
|
|
version = version_grp.group(1)
|
|
else:
|
|
version = "0.0.0"
|
|
|
|
f.seek(0)
|
|
description_grp = re.search(r"__description__ = ['\"](.+)['\"]", f.read())
|
|
if description_grp:
|
|
description = description_grp.group(1)
|
|
else:
|
|
description = "Disconnected Universal IMAP Mail Synchronization/Reader Support"
|
|
|
|
f.seek(0)
|
|
author_grp = re.search(r"__author__ = ['\"](.+)['\"]", f.read())
|
|
if author_grp:
|
|
author = author_grp.group(1)
|
|
else:
|
|
author = "John Goerzen"
|
|
|
|
f.seek(0)
|
|
author_email_grp = re.search(r"__author_email__ = ['\"](.+)['\"]", f.read())
|
|
if author_email_grp:
|
|
author_email = author_email_grp.group(1)
|
|
else:
|
|
author_email = ""
|
|
|
|
f.seek(0)
|
|
homepage_grp = re.search(r"__homepage__ = ['\"](.+)['\"]", f.read())
|
|
if homepage_grp:
|
|
homepage = homepage_grp.group(1)
|
|
else:
|
|
homepage = "http://www.offlineimap.org"
|
|
|
|
f.seek(0)
|
|
copyright_grp = re.search(r"__copyright__ = ['\"](.+)['\"]", f.read())
|
|
if copyright_grp:
|
|
copyright = copyright_grp.group(1)
|
|
else:
|
|
copyright = ""
|
|
|
|
|
|
setup(name="offlineimap",
|
|
version=version,
|
|
description=description,
|
|
long_description=description,
|
|
author=author,
|
|
author_email=author_email,
|
|
url=homepage,
|
|
packages=['offlineimap', 'offlineimap.folder',
|
|
'offlineimap.repository', 'offlineimap.ui',
|
|
'offlineimap.utils'],
|
|
scripts=['bin/offlineimap'],
|
|
setup_requires=['setuptools>=18.5', 'wheel', 'imaplib2'],
|
|
license=copyright + ", Licensed under the GPL version 2",
|
|
install_requires=['distro',
|
|
'imaplib2>=3.5',
|
|
'rfc6555',
|
|
'urllib3~=1.25.9'],
|
|
extras_require={'kerberos':'gssapi[kerberos]',
|
|
'keyring':'keyring[keyring]',
|
|
'cygwin':'portalocker[cygwin]',
|
|
'testinternet':'certifi~=2020.6.20'}
|
|
)
|
|
|