Skip to content

Commit

Permalink
refactored setup.py to make sure we dont import ExtractMsg before ole…
Browse files Browse the repository at this point in the history
…file has been installed
  • Loading branch information
Dean Malmgren committed Jun 15, 2015
1 parent 09732fd commit edec048
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import glob
import os
from setuptools import setup
import re

import ExtractMsg

# a handful of variables that are used a couple of times
github_url = 'https://github.com/mattgwwalker/msg-extractor'
main_module = 'ExtractMsg'
main_script = main_module + '.py'

# read in the description from README
with open("README.md") as stream:
long_description = stream.read()

github_url = 'https://github.com/mattgwwalker/msg-extractor'
# get the version from the ExtractMsg script. This can not be directly
# imported because ExtractMsg imports olefile, which isn't installed yet
version_re = re.compile("__version__ = '(?P<version>[0-9\.]*)'")
with open(main_script, 'r') as stream:
contents = stream.read()
match = version_re.search(contents)
version = match.groupdict()['version']

# read in the dependencies from the virtualenv requirements file
dependencies = []
Expand All @@ -20,16 +31,16 @@
dependencies.append(package)

setup(
name="ExtractMsg",
version=ExtractMsg.__version__,
name=main_module,
version=version,
description="Extracts emails and attachments saved in Microsoft Outlook's .msg files",
long_description=long_description,
url=github_url,
download_url="%s/archives/master" % github_url,
author='Matthew Walker',
author_email='mattgwwalker at gmail.com',
license='GPL',
scripts=["ExtractMsg.py"],
py_modules=["ExtractMsg"],
scripts=[main_script],
py_modules=[main_module],
install_requires=dependencies,
)

0 comments on commit edec048

Please sign in to comment.