Skip to content

Commit 2acee50

Browse files
switch to setuptools_scm, a package and the src layout
1 parent 0e4f1cc commit 2acee50

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

setup.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
import re
2-
from setuptools import setup
2+
from setuptools import setup, find_packages
33

44

5-
def get_version():
6-
VERSION_RE = re.compile("__version__ = \'(.*)\'", re.M)
7-
with open('apipkg.py') as fp:
8-
return VERSION_RE.search(fp.read()).group(1)
5+
def readme():
6+
with open('README.txt') as fp:
7+
return fp.read()
98

109

1110
def main():
1211
setup(
1312
name='apipkg',
1413
description='apipkg: namespace control and lazy-import mechanism',
15-
long_description=open('README.txt').read(),
16-
version=get_version(),
17-
url='http://bitbucket.org/hpk42/apipkg',
14+
long_description=readme(),
15+
setup_requires=[
16+
'setuptools_scm',
17+
'setuptools>=30.3.0', # introduced setup.cfg metadata
18+
],
19+
use_scm_version={
20+
'write_to': 'src/apipkg/version.py'
21+
},
22+
url='http://github.com/pytest-dev/apipkg',
1823
license='MIT License',
1924
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
2025
author='holger krekel',
2126
author_email='holger at merlinux.eu',
27+
maintainer="Ronny Pfannschmidt",
28+
maintainer_email="[email protected]",
2229
classifiers=[
2330
'Development Status :: 4 - Beta',
2431
'Intended Audience :: Developers',
@@ -28,7 +35,8 @@ def main():
2835
'Operating System :: MacOS :: MacOS X',
2936
'Topic :: Software Development :: Libraries',
3037
'Programming Language :: Python'],
31-
py_modules=['apipkg'],
38+
packages=find_packages('src'),
39+
package_dir={'': 'src'},
3240
)
3341

3442
if __name__ == '__main__':

apipkg.py renamed to src/apipkg/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
import sys
1010
from types import ModuleType
1111

12-
13-
__version__ = '1.5.dev1'
14-
12+
from .version import version as __version__
1513

1614
def _py_abspath(path):
1715
"""

test_apipkg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ def patchgetattr(self, name):
383383
assert 'abspath' in d
384384

385385

386-
def test_chdir_with_relative_imports_shouldnt_break_lazy_loading(tmpdir):
387-
tmpdir.join('apipkg.py').write(py.code.Source(apipkg))
386+
def test_chdir_with_relative_imports_support_lazy_loading(tmpdir, monkeypatch):
387+
monkeypatch.syspath_prepend(py.path.local('src'))
388388
pkg = tmpdir.mkdir('pkg')
389389
tmpdir.mkdir('messy')
390390
pkg.join('__init__.py').write(py.code.Source("""

0 commit comments

Comments
 (0)