Browse Source
Move bat files to CRLF as they are pure Windows files. Added an section to .editorconfig for .bat files. For cross-platform libraries, Unix line endings are more conventional than Windows line endings.pull/67/head

5 changed files with 393 additions and 390 deletions
@ -1,28 +1,28 @@
|
||||
""" |
||||
olefile (formerly OleFileIO_PL) |
||||
|
||||
Module to read/write Microsoft OLE2 files (also called Structured Storage or |
||||
Microsoft Compound Document File Format), such as Microsoft Office 97-2003 |
||||
documents, Image Composer and FlashPix files, Outlook messages, ... |
||||
This version is compatible with Python 2.6+ and 3.x |
||||
|
||||
Project website: https://www.decalage.info/olefile |
||||
|
||||
olefile is copyright (c) 2005-2017 Philippe Lagadec (https://www.decalage.info) |
||||
|
||||
olefile is based on the OleFileIO module from the PIL library v1.1.7 |
||||
See: http://www.pythonware.com/products/pil/index.htm |
||||
and http://svn.effbot.org/public/tags/pil-1.1.7/PIL/OleFileIO.py |
||||
|
||||
The Python Imaging Library (PIL) is |
||||
Copyright (c) 1997-2009 by Secret Labs AB |
||||
Copyright (c) 1995-2009 by Fredrik Lundh |
||||
|
||||
See source code and LICENSE.txt for information on usage and redistribution. |
||||
""" |
||||
|
||||
# The OleFileIO_PL module is for backward compatibility |
||||
|
||||
from olefile.olefile import * |
||||
# import metadata not covered by *: |
||||
from olefile.olefile import __version__, __author__, __date__ |
||||
""" |
||||
olefile (formerly OleFileIO_PL) |
||||
|
||||
Module to read/write Microsoft OLE2 files (also called Structured Storage or |
||||
Microsoft Compound Document File Format), such as Microsoft Office 97-2003 |
||||
documents, Image Composer and FlashPix files, Outlook messages, ... |
||||
This version is compatible with Python 2.6+ and 3.x |
||||
|
||||
Project website: https://www.decalage.info/olefile |
||||
|
||||
olefile is copyright (c) 2005-2017 Philippe Lagadec (https://www.decalage.info) |
||||
|
||||
olefile is based on the OleFileIO module from the PIL library v1.1.7 |
||||
See: http://www.pythonware.com/products/pil/index.htm |
||||
and http://svn.effbot.org/public/tags/pil-1.1.7/PIL/OleFileIO.py |
||||
|
||||
The Python Imaging Library (PIL) is |
||||
Copyright (c) 1997-2009 by Secret Labs AB |
||||
Copyright (c) 1995-2009 by Fredrik Lundh |
||||
|
||||
See source code and LICENSE.txt for information on usage and redistribution. |
||||
""" |
||||
|
||||
# The OleFileIO_PL module is for backward compatibility |
||||
|
||||
from olefile.olefile import * |
||||
# import metadata not covered by *: |
||||
from olefile.olefile import __version__, __author__, __date__ |
||||
|
@ -1,36 +1,36 @@
|
||||
@ECHO OFF |
||||
|
||||
pushd %~dp0 |
||||
|
||||
REM Command file for Sphinx documentation |
||||
|
||||
if "%SPHINXBUILD%" == "" ( |
||||
set SPHINXBUILD=sphinx-build |
||||
) |
||||
set SOURCEDIR=. |
||||
set BUILDDIR=_build |
||||
set SPHINXPROJ=olefile |
||||
|
||||
if "%1" == "" goto help |
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL |
||||
if errorlevel 9009 ( |
||||
echo. |
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx |
||||
echo.installed, then set the SPHINXBUILD environment variable to point |
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you |
||||
echo.may add the Sphinx directory to PATH. |
||||
echo. |
||||
echo.If you don't have Sphinx installed, grab it from |
||||
echo.http://sphinx-doc.org/ |
||||
exit /b 1 |
||||
) |
||||
|
||||
%SPHINXBUILD% -M %1 %2 %3 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
goto end |
||||
|
||||
:help |
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
|
||||
:end |
||||
popd |
||||
@ECHO OFF |
||||
|
||||
pushd %~dp0 |
||||
|
||||
REM Command file for Sphinx documentation |
||||
|
||||
if "%SPHINXBUILD%" == "" ( |
||||
set SPHINXBUILD=sphinx-build |
||||
) |
||||
set SOURCEDIR=. |
||||
set BUILDDIR=_build |
||||
set SPHINXPROJ=olefile |
||||
|
||||
if "%1" == "" goto help |
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL |
||||
if errorlevel 9009 ( |
||||
echo. |
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx |
||||
echo.installed, then set the SPHINXBUILD environment variable to point |
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you |
||||
echo.may add the Sphinx directory to PATH. |
||||
echo. |
||||
echo.If you don't have Sphinx installed, grab it from |
||||
echo.http://sphinx-doc.org/ |
||||
exit /b 1 |
||||
) |
||||
|
||||
%SPHINXBUILD% -M %1 %2 %3 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
goto end |
||||
|
||||
:help |
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
|
||||
:end |
||||
popd |
||||
|
@ -1,56 +1,56 @@
|
||||
LICENSE for the olefile package: |
||||
|
||||
olefile (formerly OleFileIO_PL) is copyright (c) 2005-2017 Philippe Lagadec |
||||
(https://www.decalage.info) |
||||
|
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this |
||||
list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
|
||||
---------- |
||||
|
||||
olefile is based on source code from the OleFileIO module of the Python |
||||
Imaging Library (PIL) published by Fredrik Lundh under the following license: |
||||
|
||||
The Python Imaging Library (PIL) is |
||||
- Copyright (c) 1997-2009 by Secret Labs AB |
||||
- Copyright (c) 1995-2009 by Fredrik Lundh |
||||
|
||||
By obtaining, using, and/or copying this software and/or its associated |
||||
documentation, you agree that you have read, understood, and will comply with |
||||
the following terms and conditions: |
||||
|
||||
Permission to use, copy, modify, and distribute this software and its |
||||
associated documentation for any purpose and without fee is hereby granted, |
||||
provided that the above copyright notice appears in all copies, and that both |
||||
that copyright notice and this permission notice appear in supporting |
||||
documentation, and that the name of Secret Labs AB or the author not be used |
||||
in advertising or publicity pertaining to distribution of the software without |
||||
specific, written prior permission. |
||||
|
||||
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN |
||||
NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL, |
||||
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
||||
PERFORMANCE OF THIS SOFTWARE. |
||||
LICENSE for the olefile package: |
||||
|
||||
olefile (formerly OleFileIO_PL) is copyright (c) 2005-2017 Philippe Lagadec |
||||
(https://www.decalage.info) |
||||
|
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this |
||||
list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
|
||||
---------- |
||||
|
||||
olefile is based on source code from the OleFileIO module of the Python |
||||
Imaging Library (PIL) published by Fredrik Lundh under the following license: |
||||
|
||||
The Python Imaging Library (PIL) is |
||||
- Copyright (c) 1997-2009 by Secret Labs AB |
||||
- Copyright (c) 1995-2009 by Fredrik Lundh |
||||
|
||||
By obtaining, using, and/or copying this software and/or its associated |
||||
documentation, you agree that you have read, understood, and will comply with |
||||
the following terms and conditions: |
||||
|
||||
Permission to use, copy, modify, and distribute this software and its |
||||
associated documentation for any purpose and without fee is hereby granted, |
||||
provided that the above copyright notice appears in all copies, and that both |
||||
that copyright notice and this permission notice appear in supporting |
||||
documentation, and that the name of Secret Labs AB or the author not be used |
||||
in advertising or publicity pertaining to distribution of the software without |
||||
specific, written prior permission. |
||||
|
||||
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN |
||||
NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL, |
||||
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
||||
PERFORMANCE OF THIS SOFTWARE. |
||||
|
@ -1,270 +1,270 @@
|
||||
""" |
||||
Installation script for olefile using distutils |
||||
|
||||
To install this package, run: |
||||
python setup.py install |
||||
|
||||
(setup script partly borrowed from cherrypy) |
||||
""" |
||||
|
||||
#--- CHANGELOG ---------------------------------------------------------------- |
||||
|
||||
# 2007-09-13 v0.01 PL: - first version |
||||
# 2007-11-10 v0.02 PL: - updated website URL |
||||
# 2007-12-04 v0.03 PL: - updated description, added debug_mode test |
||||
# 2009-09-11 v0.04 PL: - updated URL, e-mail, licence, disabled e-mail |
||||
# 2012-02-16 v0.05 PL: - added download URL on bitbucket |
||||
# 2012-09-11 v0.06 PL: - read long description from disk in rst format |
||||
# 2014-02-04 v0.07 PL: - added PyPI classifier for Python 3.x, added PL2 version |
||||
# 2014-09-26 v0.08 PL: - install the olefile package instead of modules |
||||
# 2014-10-10 v0.09 PL: - fixed compilation error on Python 3 |
||||
# 2016-01-29 v0.10 PL: - fixed issue #28, removed DEBUG_MODE test |
||||
# 2016-01-05 v0.44 PL: - removed the legacy doc subfolder |
||||
|
||||
|
||||
#--- TODO --------------------------------------------------------------------- |
||||
|
||||
|
||||
#--- IMPORTS ------------------------------------------------------------------ |
||||
|
||||
try: |
||||
from setuptools import setup |
||||
except ImportError: |
||||
from distutils.core import setup |
||||
|
||||
import sys, os, fnmatch |
||||
|
||||
from olefile import __version__, __author__ |
||||
|
||||
|
||||
#--- METADATA ----------------------------------------------------------------- |
||||
|
||||
name = "olefile" |
||||
version = __version__ |
||||
desc = "Python package to parse, read and write Microsoft OLE2 files (Structured Storage or Compound Document, Microsoft Office) - Improved version of the OleFileIO module from PIL, the Python Image Library." |
||||
# read long description from disk in restructuredtext format: |
||||
long_desc = open('olefile/README.rst').read() |
||||
author = __author__ |
||||
author_email = "https://www.decalage.info/contact" |
||||
url = "https://www.decalage.info/python/olefileio" |
||||
license = "BSD" |
||||
download_url = "https://github.com/decalage2/olefile/tarball/master" |
||||
|
||||
classifiers=[ |
||||
"Development Status :: 4 - Beta", |
||||
"Intended Audience :: Developers", |
||||
"Intended Audience :: Information Technology", |
||||
"Intended Audience :: Science/Research", |
||||
"Intended Audience :: System Administrators", |
||||
"License :: OSI Approved :: BSD License", |
||||
"Operating System :: OS Independent", |
||||
"Programming Language :: Python", |
||||
"Programming Language :: Python :: 2", |
||||
"Programming Language :: Python :: 2.6", |
||||
"Programming Language :: Python :: 2.7", |
||||
"Programming Language :: Python :: 3", |
||||
"Programming Language :: Python :: 3.2", |
||||
"Programming Language :: Python :: 3.3", |
||||
"Programming Language :: Python :: 3.4", |
||||
"Programming Language :: Python :: 3.5", |
||||
"Programming Language :: Python :: 3.6", |
||||
"Programming Language :: Python :: Implementation :: CPython", |
||||
"Programming Language :: Python :: Implementation :: PyPy", |
||||
"Topic :: Software Development :: Libraries :: Python Modules" |
||||
] |
||||
|
||||
#--- PACKAGES ----------------------------------------------------------------- |
||||
|
||||
packages=[ |
||||
"olefile", |
||||
] |
||||
|
||||
modules = ['OleFileIO_PL'] |
||||
|
||||
##setupdir = '.' |
||||
##package_dir={'': setupdir} |
||||
|
||||
#--- PACKAGE DATA ------------------------------------------------------------- |
||||
|
||||
## Often, additional files need to be installed into a package. These files are |
||||
## often data that?s closely related to the package?s implementation, or text |
||||
## files containing documentation that might be of interest to programmers using |
||||
## the package. These files are called package data. |
||||
## |
||||
## Package data can be added to packages using the package_data keyword argument |
||||
## to the setup() function. The value must be a mapping from package name to a |
||||
## list of relative path names that should be copied into the package. The paths |
||||
## are interpreted as relative to the directory containing the package |
||||
## (information from the package_dir mapping is used if appropriate); that is, |
||||
## the files are expected to be part of the package in the source directories. |
||||
## They may contain glob patterns as well. |
||||
## |
||||
## The path names may contain directory portions; any necessary directories will |
||||
## be created in the installation. |
||||
|
||||
|
||||
# the following functions are used to dynamically include package data without |
||||
# listing every file here: |
||||
|
||||
def riglob(top, prefix='', pattern='*'): |
||||
""" |
||||
recursive iterator glob |
||||
- top: path to start searching from |
||||
- prefix: path to use instead of top when generating file path (in order to |
||||
choose the root of relative paths) |
||||
- pattern: wildcards to select files (same syntax as fnmatch) |
||||
|
||||
Yields each file found in top and subdirectories, matching pattern |
||||
""" |
||||
#print 'top=%s prefix=%s pat=%s' % (top, prefix, pattern) |
||||
dirs = [] |
||||
for path in os.listdir(top): |
||||
p = os.path.join(top, path) |
||||
if os.path.isdir(p): |
||||
dirs.append(path) |
||||
elif os.path.isfile(p): |
||||
#print ' - file:', path |
||||
if fnmatch.fnmatch(path, pattern): |
||||
yield os.path.join(prefix, path) |
||||
#print ' dirs =', dirs |
||||
for d in dirs: |
||||
dtop = os.path.join(top, d) |
||||
dprefix = os.path.join(prefix, d) |
||||
#print 'dtop=%s dprefix=%s' % (dtop, dprefix) |
||||
for p in riglob(dtop, dprefix, pattern): |
||||
yield p |
||||
|
||||
def rglob(top, prefix='', pattern='*'): |
||||
""" |
||||
recursive glob |
||||
Same as riglob, but returns a list. |
||||
""" |
||||
return list(riglob(top, prefix, pattern)) |
||||
|
||||
|
||||
|
||||
|
||||
package_data={ |
||||
'olefile': [ |
||||
'README.rst', |
||||
'README.html', |
||||
'LICENSE.txt', |
||||
'CONTRIBUTORS.txt', |
||||
# 'olefile.html', |
||||
] |
||||
# doc folder: md, html, png |
||||
# + rglob('olefile/doc', 'doc', '*.html') |
||||
# + rglob('olefile/doc', 'doc', '*.md') |
||||
# + rglob('olefile/doc', 'doc', '*.png'), |
||||
} |
||||
|
||||
|
||||
#--- data files --------------------------------------------------------------- |
||||
|
||||
# not used for now. |
||||
|
||||
## The data_files option can be used to specify additional files needed by the |
||||
## module distribution: configuration files, message catalogs, data files, |
||||
## anything which doesn?t fit in the previous categories. |
||||
## |
||||
## data_files specifies a sequence of (directory, files) pairs in the following way: |
||||
## |
||||
## setup(..., |
||||
## data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']), |
||||
## ('config', ['cfg/data.cfg']), |
||||
## ('/etc/init.d', ['init-script'])] |
||||
## ) |
||||
## |
||||
## Note that you can specify the directory names where the data files will be |
||||
## installed, but you cannot rename the data files themselves. |
||||
## |
||||
## Each (directory, files) pair in the sequence specifies the installation |
||||
## directory and the files to install there. If directory is a relative path, |
||||
## it is interpreted relative to the installation prefix (Python?s sys.prefix for |
||||
## pure-Python packages, sys.exec_prefix for packages that contain extension |
||||
## modules). Each file name in files is interpreted relative to the setup.py |
||||
## script at the top of the package source distribution. No directory information |
||||
## from files is used to determine the final location of the installed file; |
||||
## only the name of the file is used. |
||||
## |
||||
## You can specify the data_files options as a simple sequence of files without |
||||
## specifying a target directory, but this is not recommended, and the install |
||||
## command will print a warning in this case. To install data files directly in |
||||
## the target directory, an empty string should be given as the directory. |
||||
|
||||
|
||||
|
||||
##data_files=[ |
||||
## ('balbuzard', [ |
||||
## 'balbuzard/README.txt', |
||||
## ]), |
||||
##] |
||||
|
||||
##if sys.version_info >= (3, 0): |
||||
## required_python_version = '3.0' |
||||
## setupdir = 'py3' |
||||
##else: |
||||
## required_python_version = '2.3' |
||||
## setupdir = 'py2' |
||||
|
||||
##data_files = [(install_dir, ['%s/%s' % (setupdir, f) for f in files]) |
||||
## for install_dir, files in data_files] |
||||
|
||||
|
||||
##def fix_data_files(data_files): |
||||
## """ |
||||
## bdist_wininst seems to have a bug about where it installs data files. |
||||
## I found a fix the django team used to work around the problem at |
||||
## http://code.djangoproject.com/changeset/8313 . This function |
||||
## re-implements that solution. |
||||
## Also see http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
||||
## for more info. |
||||
## """ |
||||
## def fix_dest_path(path): |
||||
## return '\\PURELIB\\%(path)s' % vars() |
||||
## |
||||
## if not 'bdist_wininst' in sys.argv: return |
||||
## |
||||
## data_files[:] = [ |
||||
## (fix_dest_path(path), files) |
||||
## for path, files in data_files] |
||||
##fix_data_files(data_files) |
||||
|
||||
|
||||
#--- SCRIPTS ------------------------------------------------------------------ |
||||
|
||||
# not used for now. |
||||
|
||||
#scripts = ["%s/cherrypy/cherryd" % setupdir] |
||||
|
||||
|
||||
#=== MAIN ===================================================================== |
||||
|
||||
def main(): |
||||
## # set default location for "data_files" to |
||||
## # platform specific "site-packages" location |
||||
## for scheme in list(INSTALL_SCHEMES.values()): |
||||
## scheme['data'] = scheme['purelib'] |
||||
|
||||
dist = setup( |
||||
name=name, |
||||
version=version, |
||||
description=desc, |
||||
long_description=long_desc, |
||||
classifiers=classifiers, |
||||
author=author, |
||||
author_email=author_email, |
||||
url=url, |
||||
license=license, |
||||
## package_dir=package_dir, |
||||
packages=packages, |
||||
package_data = package_data, |
||||
py_modules = modules, |
||||
download_url=download_url, |
||||
# data_files=data_files, |
||||
# scripts=scripts, |
||||
) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
""" |
||||
Installation script for olefile using distutils |
||||
|
||||
To install this package, run: |
||||
python setup.py install |
||||
|
||||
(setup script partly borrowed from cherrypy) |
||||
""" |
||||
|
||||
#--- CHANGELOG ---------------------------------------------------------------- |
||||
|
||||
# 2007-09-13 v0.01 PL: - first version |
||||
# 2007-11-10 v0.02 PL: - updated website URL |
||||
# 2007-12-04 v0.03 PL: - updated description, added debug_mode test |
||||
# 2009-09-11 v0.04 PL: - updated URL, e-mail, licence, disabled e-mail |
||||
# 2012-02-16 v0.05 PL: - added download URL on bitbucket |
||||
# 2012-09-11 v0.06 PL: - read long description from disk in rst format |
||||
# 2014-02-04 v0.07 PL: - added PyPI classifier for Python 3.x, added PL2 version |
||||
# 2014-09-26 v0.08 PL: - install the olefile package instead of modules |
||||
# 2014-10-10 v0.09 PL: - fixed compilation error on Python 3 |
||||
# 2016-01-29 v0.10 PL: - fixed issue #28, removed DEBUG_MODE test |
||||
# 2016-01-05 v0.44 PL: - removed the legacy doc subfolder |
||||
|
||||
|
||||
#--- TODO --------------------------------------------------------------------- |
||||
|
||||
|
||||
#--- IMPORTS ------------------------------------------------------------------ |
||||
|
||||
try: |
||||
from setuptools import setup |
||||
except ImportError: |
||||
from distutils.core import setup |
||||
|
||||
import sys, os, fnmatch |
||||
|
||||
from olefile import __version__, __author__ |
||||
|
||||
|
||||
#--- METADATA ----------------------------------------------------------------- |
||||
|
||||
name = "olefile" |
||||
version = __version__ |
||||
desc = "Python package to parse, read and write Microsoft OLE2 files (Structured Storage or Compound Document, Microsoft Office) - Improved version of the OleFileIO module from PIL, the Python Image Library." |
||||
# read long description from disk in restructuredtext format: |
||||
long_desc = open('olefile/README.rst').read() |
||||
author = __author__ |
||||
author_email = "https://www.decalage.info/contact" |
||||
url = "https://www.decalage.info/python/olefileio" |
||||
license = "BSD" |
||||
download_url = "https://github.com/decalage2/olefile/tarball/master" |
||||
|
||||
classifiers=[ |
||||
"Development Status :: 4 - Beta", |
||||
"Intended Audience :: Developers", |
||||
"Intended Audience :: Information Technology", |
||||
"Intended Audience :: Science/Research", |
||||
"Intended Audience :: System Administrators", |
||||
"License :: OSI Approved :: BSD License", |
||||
"Operating System :: OS Independent", |
||||
"Programming Language :: Python", |
||||
"Programming Language :: Python :: 2", |
||||
"Programming Language :: Python :: 2.6", |
||||
"Programming Language :: Python :: 2.7", |
||||
"Programming Language :: Python :: 3", |
||||
"Programming Language :: Python :: 3.2", |
||||
"Programming Language :: Python :: 3.3", |
||||
"Programming Language :: Python :: 3.4", |
||||
"Programming Language :: Python :: 3.5", |
||||
"Programming Language :: Python :: 3.6", |
||||
"Programming Language :: Python :: Implementation :: CPython", |
||||
"Programming Language :: Python :: Implementation :: PyPy", |
||||
"Topic :: Software Development :: Libraries :: Python Modules" |
||||
] |
||||
|
||||
#--- PACKAGES ----------------------------------------------------------------- |
||||
|
||||
packages=[ |
||||
"olefile", |
||||
] |
||||
|
||||
modules = ['OleFileIO_PL'] |
||||
|
||||
##setupdir = '.' |
||||
##package_dir={'': setupdir} |
||||
|
||||
#--- PACKAGE DATA ------------------------------------------------------------- |
||||
|
||||
## Often, additional files need to be installed into a package. These files are |
||||
## often data that?s closely related to the package?s implementation, or text |
||||
## files containing documentation that might be of interest to programmers using |
||||
## the package. These files are called package data. |
||||
## |
||||
## Package data can be added to packages using the package_data keyword argument |
||||
## to the setup() function. The value must be a mapping from package name to a |
||||
## list of relative path names that should be copied into the package. The paths |
||||
## are interpreted as relative to the directory containing the package |
||||
## (information from the package_dir mapping is used if appropriate); that is, |
||||
## the files are expected to be part of the package in the source directories. |
||||
## They may contain glob patterns as well. |
||||
## |
||||
## The path names may contain directory portions; any necessary directories will |
||||
## be created in the installation. |
||||
|
||||
|
||||
# the following functions are used to dynamically include package data without |
||||
# listing every file here: |
||||
|
||||
def riglob(top, prefix='', pattern='*'): |
||||
""" |
||||
recursive iterator glob |
||||
- top: path to start searching from |
||||
- prefix: path to use instead of top when generating file path (in order to |
||||
choose the root of relative paths) |
||||
- pattern: wildcards to select files (same syntax as fnmatch) |
||||
|
||||
Yields each file found in top and subdirectories, matching pattern |
||||
""" |
||||
#print 'top=%s prefix=%s pat=%s' % (top, prefix, pattern) |
||||
dirs = [] |
||||
for path in os.listdir(top): |
||||
p = os.path.join(top, path) |
||||
if os.path.isdir(p): |
||||
dirs.append(path) |
||||
elif os.path.isfile(p): |
||||
#print ' - file:', path |
||||
if fnmatch.fnmatch(path, pattern): |
||||
yield os.path.join(prefix, path) |
||||
#print ' dirs =', dirs |
||||
for d in dirs: |
||||
dtop = os.path.join(top, d) |
||||
dprefix = os.path.join(prefix, d) |
||||
#print 'dtop=%s dprefix=%s' % (dtop, dprefix) |
||||
for p in riglob(dtop, dprefix, pattern): |
||||
yield p |
||||
|
||||
def rglob(top, prefix='', pattern='*'): |
||||
""" |
||||
recursive glob |
||||
Same as riglob, but returns a list. |
||||
""" |
||||
return list(riglob(top, prefix, pattern)) |
||||
|
||||
|
||||
|
||||
|
||||
package_data={ |
||||
'olefile': [ |
||||
'README.rst', |
||||
'README.html', |
||||
'LICENSE.txt', |
||||
'CONTRIBUTORS.txt', |
||||
# 'olefile.html', |
||||
] |
||||
# doc folder: md, html, png |
||||
# + rglob('olefile/doc', 'doc', '*.html') |
||||
# + rglob('olefile/doc', 'doc', '*.md') |
||||
# + rglob('olefile/doc', 'doc', '*.png'), |
||||
} |
||||
|
||||
|
||||
#--- data files --------------------------------------------------------------- |
||||
|
||||
# not used for now. |
||||
|
||||
## The data_files option can be used to specify additional files needed by the |
||||
## module distribution: configuration files, message catalogs, data files, |
||||
## anything which doesn?t fit in the previous categories. |
||||
## |
||||
## data_files specifies a sequence of (directory, files) pairs in the following way: |
||||
## |
||||
## setup(..., |
||||
## data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']), |
||||
## ('config', ['cfg/data.cfg']), |
||||
## ('/etc/init.d', ['init-script'])] |
||||
## ) |
||||
## |
||||
## Note that you can specify the directory names where the data files will be |
||||
## installed, but you cannot rename the data files themselves. |
||||
## |
||||
## Each (directory, files) pair in the sequence specifies the installation |
||||
## directory and the files to install there. If directory is a relative path, |
||||
## it is interpreted relative to the installation prefix (Python?s sys.prefix for |
||||
## pure-Python packages, sys.exec_prefix for packages that contain extension |
||||
## modules). Each file name in files is interpreted relative to the setup.py |
||||
## script at the top of the package source distribution. No directory information |
||||
## from files is used to determine the final location of the installed file; |
||||
## only the name of the file is used. |
||||
## |
||||
## You can specify the data_files options as a simple sequence of files without |
||||
## specifying a target directory, but this is not recommended, and the install |
||||
## command will print a warning in this case. To install data files directly in |
||||
## the target directory, an empty string should be given as the directory. |
||||
|
||||
|
||||
|
||||
##data_files=[ |
||||
## ('balbuzard', [ |
||||
## 'balbuzard/README.txt', |
||||
## ]), |
||||
##] |
||||
|
||||
##if sys.version_info >= (3, 0): |
||||
## required_python_version = '3.0' |
||||
## setupdir = 'py3' |
||||
##else: |
||||
## required_python_version = '2.3' |
||||
## setupdir = 'py2' |
||||
|
||||
##data_files = [(install_dir, ['%s/%s' % (setupdir, f) for f in files]) |
||||
## for install_dir, files in data_files] |
||||
|
||||
|
||||
##def fix_data_files(data_files): |
||||
## """ |
||||
## bdist_wininst seems to have a bug about where it installs data files. |
||||
## I found a fix the django team used to work around the problem at |
||||
## http://code.djangoproject.com/changeset/8313 . This function |
||||
## re-implements that solution. |
||||
## Also see http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
||||
## for more info. |
||||
## """ |
||||
## def fix_dest_path(path): |
||||
## return '\\PURELIB\\%(path)s' % vars() |
||||
## |
||||
## if not 'bdist_wininst' in sys.argv: return |
||||
## |
||||
## data_files[:] = [ |
||||
## (fix_dest_path(path), files) |
||||
## for path, files in data_files] |
||||
##fix_data_files(data_files) |
||||
|
||||
|
||||
#--- SCRIPTS ------------------------------------------------------------------ |
||||
|
||||
# not used for now. |
||||
|
||||
#scripts = ["%s/cherrypy/cherryd" % setupdir] |
||||
|
||||
|
||||
#=== MAIN ===================================================================== |
||||
|
||||
def main(): |
||||
## # set default location for "data_files" to |
||||
## # platform specific "site-packages" location |
||||
## for scheme in list(INSTALL_SCHEMES.values()): |
||||
## scheme['data'] = scheme['purelib'] |
||||
|
||||
dist = setup( |
||||
name=name, |
||||
version=version, |
||||
description=desc, |
||||
long_description=long_desc, |
||||
classifiers=classifiers, |
||||
author=author, |
||||
author_email=author_email, |
||||
url=url, |
||||
license=license, |
||||
## package_dir=package_dir, |
||||
packages=packages, |
||||
package_data = package_data, |
||||
py_modules = modules, |
||||
download_url=download_url, |
||||
# data_files=data_files, |
||||
# scripts=scripts, |
||||
) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
|
Loading…
Reference in new issue