-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from itziakos/remove-py2-support
Drop python < 3.8 and support 3.12
- Loading branch information
Showing
12 changed files
with
126 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
include LICENSE | ||
include CHANGELOG | ||
include *.rst | ||
include *.txt | ||
include *.cfg | ||
recursive-include docs *.bat *.py *.rst | ||
include docs/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.0.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[metadata] | ||
name = zipfile2 | ||
version = file: VERSION | ||
url = https://github.com/itziakos/zipfile2 | ||
author = Ioannis Tziakos | ||
author_email = itziakos@gmail.com | ||
description = An improved ZipFile class that may be used as a backward compatible replacement. | ||
long_description = file: README.rst, CHANGELOG.txt | ||
license = BSD-3-Clause | ||
license_files = file: LICENSE | ||
classifier = | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Programming Language :: Python :: 3.11 | ||
Programming Language :: Python :: 3.12 | ||
|
||
[options] | ||
zip_safe = False | ||
packages = find: | ||
python_requires = >=3.8 | ||
|
||
[options.packages.find] | ||
exclude = docs* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,9 @@ | ||
import os | ||
import subprocess | ||
|
||
from pathlib import Path | ||
from setuptools import setup | ||
|
||
HERE = Path(__file__).parent | ||
version = (HERE / 'VERSION').read_text().strip() | ||
filename = (HERE / 'zipfile2' / '_version.py') | ||
filename.write_text(f"__version__ = '{version}'\n") | ||
|
||
MAJOR = 0 | ||
MINOR = 0 | ||
MICRO = 13 | ||
|
||
IS_RELEASED = False | ||
|
||
VERSION_INFO = (MAJOR, MINOR, MICRO) | ||
VERSION = ".".join(str(i) for i in VERSION_INFO) | ||
|
||
|
||
# Return the git revision as a string | ||
def git_version(): | ||
def _minimal_ext_cmd(cmd): | ||
# construct minimal environment | ||
env = {} | ||
for k in ['SYSTEMROOT', 'PATH']: | ||
v = os.environ.get(k) | ||
if v is not None: | ||
env[k] = v | ||
# LANGUAGE is used on win32 | ||
env['LANGUAGE'] = 'C' | ||
env['LANG'] = 'C' | ||
env['LC_ALL'] = 'C' | ||
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0] | ||
return out | ||
|
||
try: | ||
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD']) | ||
git_revision = out.strip().decode('ascii') | ||
except OSError: | ||
git_revision = "Unknown" | ||
|
||
try: | ||
out = _minimal_ext_cmd(['git', 'rev-list', '--count', 'HEAD']) | ||
git_count = out.strip().decode('ascii') | ||
except OSError: | ||
git_count = "0" | ||
|
||
return git_revision, git_count | ||
|
||
|
||
def write_version_py(filename): | ||
template = """\ | ||
# THIS FILE IS GENERATED FROM ZIPFILE2 SETUP.PY | ||
version = '{version}' | ||
full_version = '{full_version}' | ||
git_revision = '{git_revision}' | ||
is_released = {is_released} | ||
if not is_released: | ||
version = full_version | ||
""" | ||
version = full_version = VERSION | ||
is_released = IS_RELEASED | ||
|
||
git_rev = "Unknown" | ||
git_count = "0" | ||
|
||
if os.path.exists('.git'): | ||
git_rev, git_count = git_version() | ||
elif os.path.exists(filename): | ||
# must be a source distribution, use existing version file | ||
try: | ||
from zipfile2._version import git_revision as git_rev | ||
except ImportError: | ||
raise ImportError("Unable to import git_revision. Try removing " | ||
"zipfile2/_version.py and the build directory " | ||
"before building.") | ||
|
||
if not is_released: | ||
full_version += '.dev{0}+{1}'.format(git_count, git_rev[:7]) | ||
|
||
with open(filename, "wt") as fp: | ||
fp.write(template.format(version=version, | ||
full_version=full_version, | ||
git_revision=git_rev, | ||
is_released=is_released)) | ||
|
||
|
||
def main(): | ||
write_version_py("zipfile2/_version.py") | ||
|
||
from zipfile2 import __version__ | ||
|
||
setup( | ||
name="zipfile2", | ||
author="David Cournapeau", | ||
author_email="cournape@gmail.com", | ||
description="An improved ZipFile class.", | ||
packages=[ | ||
"zipfile2", | ||
"zipfile2.tests", | ||
], | ||
package_data={ | ||
"zipfile2.tests": ["data/*.zip", "data/*egg"], | ||
}, | ||
version=__version__, | ||
license="PSFL", | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: Python Software Foundation License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 2.6", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3.3", | ||
"Programming Language :: Python :: 3.4", | ||
] | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
from __future__ import absolute_import | ||
|
||
try: | ||
from ._version import (full_version as __version__, | ||
git_revision as __git_revision__, | ||
is_released as __is_released__) | ||
from ._version import __version__ | ||
except ImportError: | ||
__version__ = __git_revision__ = "no-built" | ||
__is_released__ = False | ||
__version__ = "no-built" | ||
|
||
from .common import TooManyFiles | ||
from ._zipfile import ( | ||
PERMS_PRESERVE_NONE, PERMS_PRESERVE_SAFE, PERMS_PRESERVE_ALL, ZipFile | ||
) | ||
PERMS_PRESERVE_NONE, PERMS_PRESERVE_SAFE, PERMS_PRESERVE_ALL, ZipFile) | ||
from ._lean_zipfile import LeanZipFile | ||
from zipfile import ( | ||
ZIP64_LIMIT, ZIP_DEFLATED, ZIP_FILECOUNT_LIMIT, ZIP_MAX_COMMENT, | ||
ZIP_STORED, | ||
) | ||
ZIP_STORED) | ||
|
||
__all__ = [ | ||
"__git_revision__", "__is_released__", "__version__", "LeanZipFile", | ||
"TooManyFiles", "ZipFile", "PERMS_PRESERVE_NONE", "PERMS_PRESERVE_SAFE", | ||
"PERMS_PRESERVE_ALL", "ZIP64_LIMIT", "ZIP_DEFLATED", "ZIP_FILECOUNT_LIMIT", | ||
"ZIP_MAX_COMMENT", "ZIP_STORED", | ||
"__version__", | ||
"LeanZipFile", "TooManyFiles", "ZipFile", | ||
"PERMS_PRESERVE_NONE", "PERMS_PRESERVE_SAFE", | ||
"PERMS_PRESERVE_ALL", "ZIP64_LIMIT", "ZIP_DEFLATED", | ||
"ZIP_FILECOUNT_LIMIT", "ZIP_MAX_COMMENT", "ZIP_STORED", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.