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

Other cleanup #4

Closed
wants to merge 47 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
565db70
Remove support for Python releases older than 2.6
moreati Jun 19, 2015
ac3eb31
Consolidate build platform logic
moreati Jun 19, 2015
3bca937
Standardise Trove classifiers, declare OS & Python support
moreati Jun 19, 2015
119b0f2
Correct package declarations, include smartcard.pyro
moreati Jun 19, 2015
a72aa55
Switch from distutils to setuptools
moreati Jun 19, 2015
20c77ff
Add gitignore for build artefacts
moreati Jun 19, 2015
7d36645
Initial attempt at CI builds on Windows, using appveyor.com
moreati Jun 19, 2015
7b0005e
Missing comment
moreati Jun 19, 2015
88c556c
Download and install Swig in CI build
moreati Jun 19, 2015
1375471
Merge branch 'master' of github.com:moreati/pyscard
moreati Jun 20, 2015
af2c0e0
First attempt at Travis CI
moreati Jun 20, 2015
31241d9
Correct travis dependcy installation
moreati Jun 20, 2015
17feb6c
sudo helps when running apt-get
moreati Jun 20, 2015
cae9467
gitignore the config generated by the test suite
moreati Jun 22, 2015
370427c
Remove all but two uses of 'except:' & 'except Exception:'
moreati Jun 22, 2015
bedaf68
Commit convert docstring examples to doctest syntax
moreati Jun 22, 2015
7479bf1
Add default pylint config
moreati Jun 22, 2015
7b25b21
Customize pylintrc
moreati Jun 22, 2015
e1bba4b
Fix most major pylint errors and warnings
moreati Jun 22, 2015
173d961
Merge branch 'master' of github.com:LudovicRousseau/pyscard
moreati Jun 22, 2015
568d577
Consolidate Changelog, LICENSE, README etc into root dir. Delete PKG-…
moreati Jun 23, 2015
5c50b3f
Remove code supporting OS X Tiger
moreati Jun 23, 2015
fdadf6e
Reformat functions/attributes supported by `smartcard.scard` as tables
moreati Jun 23, 2015
2fb346a
Consolidate the project version in setup.py, bump to 1.7.0
moreati Jun 23, 2015
c6c442f
Merge branch 'master' of github.com:LudovicRousseau/pyscard
moreati Jun 26, 2015
2d0018b
Build Windows .exe and .msi installers
moreati Jun 28, 2015
4b639d3
README.md: Add a Continuous Integration status
LudovicRousseau Jun 26, 2015
86589a9
README.md: Add AppVeyor icon
LudovicRousseau Jun 26, 2015
907ffa2
README.md: Update travis-ci link
LudovicRousseau Jun 26, 2015
0897480
README.md: Correct Travis CI capitalisation
LudovicRousseau Jun 26, 2015
d0b7415
README.md: fix typo in Travis name
LudovicRousseau Jun 26, 2015
d552dba
configcheck.py: close file after use
LudovicRousseau Jun 27, 2015
734c8e6
Release 1.7.0
LudovicRousseau Jun 27, 2015
e30f9f8
ChangeLog: fix typos and reformat
LudovicRousseau Jun 27, 2015
cd82b30
setup.py: fix classifiers to conform to pypi
Jun 28, 2015
06a3a92
Remove support for Python releases older than 2.6
moreati Jun 19, 2015
7eee767
Consolidate build platform logic
moreati Jun 19, 2015
578da23
Standardise Trove classifiers, declare OS & Python support
moreati Jun 19, 2015
bb11fd6
Add gitignore for build artefacts
moreati Jun 19, 2015
4baa14d
Remove all but two uses of 'except:' & 'except Exception:'
moreati Jun 22, 2015
b64ec04
Fix most major pylint errors and warnings
moreati Jun 22, 2015
c9fa486
Merge branch 'master' of github.com:moreati/pyscard
moreati Jun 29, 2015
3e2f200
Revert differences to upstream@81bfc15
moreati Jun 29, 2015
b01c51d
Fix undefined variable errors found by pylint
moreati Jun 29, 2015
68f5f42
Fix missing usage of raw string
moreati Jun 29, 2015
b0f49f6
Remove no-effect loop
moreati Jun 29, 2015
9ec8fae
Fix name clash between PyroDaemonThread and threading.Thread
moreati Jun 29, 2015
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
Next Next commit
Remove support for Python releases older than 2.6
  • Loading branch information
moreati committed Jun 19, 2015
commit 565db70aa32124cfa29fe475c29ecb0a2c7b7a67
138 changes: 8 additions & 130 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@
from distutils import core, dir_util, file_util
from distutils.core import Extension
from distutils.util import get_platform
from distutils.command.build_ext import build_ext
import glob
import os
import sys

if sys.version[0:1] == '1':
raise RuntimeError("pyscard requires Python 2.x to build.")
if sys.version_info[0:2] < (2, 6):
raise RuntimeError("pyscard requires Python 2.6+ to build.")

if 'win32' == get_platform():
platform__cc_defines = [('WIN32', '100')]
Expand Down Expand Up @@ -61,27 +58,6 @@
platform_extra_compile_args = []
platform_extra_link_args = []

#
# Mac OS X Tiger has python 2.3 preinstalled
# get_platform() returns a string similar to 'darwin-8.11.1-i386' with
# python 2.3
# if python 2.5 is installed, get_platform() returns a string similar to
# 'macosx-10.3-fat'
elif 'darwin' in get_platform() \
or 'macosx-10.3' in get_platform() \
or 'macosx-10.4' in get_platform():
platform__cc_defines = [('PCSCLITE', '1'),
('__APPLE__', '1'),
('__TIGER__', '1')]
platform_swig_opts = ['-DPCSCLITE', '-D__APPLE__', '-D__TIGER__']
platform_sources = []
platform_libraries = []
platform_include_dirs = []
platform_extra_compile_args = ['-v', '-framework', 'PCSC',
'-arch', 'i386', '-arch',
'ppc', '-ggdb', '-O0']
platform_extra_link_args = ['-arch', 'i386', '-arch', 'ppc', '-ggdb']

#
# Mac OS X Lion (and above), python 2.7
# PowerPC is no more supported, x86_64 is new
Expand Down Expand Up @@ -116,23 +92,6 @@
'-arch', 'x86_64', '-ggdb']
platform_extra_link_args = ['-arch', 'i386', '-arch', 'x86_64', '-ggdb']

#
# Mac OS X Leopard has python 2.5 preinstalled
# get_platform() returns a string similar to 'macosx-10.5-i386'
#
elif 'macosx-10.5' in get_platform():
platform__cc_defines = [('PCSCLITE', '1'),
('__APPLE__', '1'),
('__LEOPARD__', '1')]
platform_swig_opts = ['-DPCSCLITE', '-D__APPLE__', '-D__LEOPARD__']
platform_sources = []
platform_libraries = []
platform_include_dirs = []
platform_extra_compile_args = ['-v', '-framework', 'PCSC',
'-arch', 'i386',
'-arch', 'ppc', '-ggdb', '-O0']
platform_extra_link_args = ['-arch', 'i386', '-arch', 'ppc', '-ggdb']
#
# Other (GNU/Linux, etc.)
#
else:
Expand All @@ -145,65 +104,6 @@
platform_extra_link_args = [] # ['-ggdb']


class _pyscardBuildExt(build_ext):
'''Specialization of build_ext to enable swig_opts
for python 2.3 distutils'''
if sys.version_info < (2, 4):

# This copy of swig_sources is from Python 2.3.
# This is to add support of swig_opts for Python 2.3 distutils
# (in particular for MacOS X darwin that comes with Python 2.3)

def swig_sources(self, sources):

"""Walk the list of source files in 'sources', looking for SWIG
interface (.i) files. Run SWIG on all that are found, and
return a modified 'sources' list with SWIG source files replaced
by the generated C (or C++) files.
"""

new_sources = []
swig_sources = []
swig_targets = {}

# XXX this drops generated C/C++ files into the source tree, which
# is fine for developers who want to distribute the generated
# source -- but there should be an option to put SWIG output in
# the temp dir.

if self.swig_cpp:
target_ext = '.cpp'
else:
target_ext = '.c'

for source in sources:
(base, ext) = os.path.splitext(source)
if ext == ".i": # SWIG interface file
new_sources.append(base + target_ext)
swig_sources.append(source)
swig_targets[source] = new_sources[-1]
else:
new_sources.append(source)

if not swig_sources:
return new_sources

swig = self.find_swig()
swig_cmd = [swig, "-python"]
if self.swig_cpp:
swig_cmd.append("-c++")

swig_cmd += platform_swig_opts

for source in swig_sources:
target = swig_targets[source]
self.announce("swigging %s to %s" % (source, target))
self.spawn(swig_cmd + ["-o", target, source])

return new_sources

build_ext.swig_sources = swig_sources

kw = {'name': "pyscard",
'version': "1.6.16",
'description': "Smartcard module for Python.",
Expand Down Expand Up @@ -248,42 +148,20 @@ def swig_sources(self, sources):
swig_opts=['-outdir',
'smartcard/scard'] \
+ platform_swig_opts)],
'cmdclass': {'build_ext': _pyscardBuildExt},
}

# If we're running >Python 2.3, add extra information
if hasattr(core, 'setup_keywords'):
if 'classifiers' in core.setup_keywords:
kw['classifiers'] = [
'classifiers': [
'Development Status :: 1.6.16 - Release',
'License :: GNU LESSER GENERAL PUBLIC LICENSE',
'Intended Audience :: Developers',
'Operating System :: Unix',
'Operating System :: Microsoft :: Windows',
'Topic :: Security :: Smartcards',
]
if 'download_url' in core.setup_keywords:
kw['download_url'] = ('http:https://sourceforge.net/projects/pyscard/'
'%s-%s.zip' % (kw['name'], kw['version']))
}

# FIXME Sourceforge downloads are unauthenticated, migrate to PyPI
kw['download_url'] = ('http:https://sourceforge.net/projects/%(name)s/files'
'/%(name)s/%(name)s%%20%(version)s'
'/%(name)s-%(version)s.tar.gz/download' % kw)

pyscard_dist = core.setup(**kw)


# Python 2.3 distutils does not support package_data
# copy manually package_data
if sys.version_info < (2, 4):
from distutils.util import convert_path
from glob import glob
if "install" in sys.argv:
targetdir = pyscard_dist.command_obj['install'].install_purelib
package_data = kw['package_data']
files = []
for directory in package_data:
for pattern in package_data[directory]:
filelist = glob(os.path.join(directory, convert_path(pattern)))
files.extend([fn for fn in filelist if fn not in files])
for file in files:
newdir = os.path.dirname(file)
dir_util.mkpath(os.path.join(targetdir, newdir))
file_util.copy_file(file, os.path.join(targetdir, file))