comparison setup.py @ 582:0467b3ae34ea

setup.py: Put the official projectname into a variable and re-use
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 09 Jan 2022 12:47:56 +0100
parents 3ad416265652
children 4e61df27b4e1
comparison
equal deleted inserted replaced
581:9ba0217a5e67 582:0467b3ae34ea
9 from setuptools import setup 9 from setuptools import setup
10 except ImportError: 10 except ImportError:
11 from distutils.core import setup 11 from distutils.core import setup
12 12
13 13
14 PROJECT_NAME = "ConfigMix"
15
16
14 if (sys.version_info[0] < 2) or \ 17 if (sys.version_info[0] < 2) or \
15 ((sys.version_info[0] == 2) and (sys.version_info[1] < 6)): 18 ((sys.version_info[0] == 2) and (sys.version_info[1] < 6)):
16 raise ValueError("Need at least Python 2.6") 19 raise ValueError("Need at least Python 2.6")
17
18 20
19 pkg_root = os.path.dirname(__file__) 21 pkg_root = os.path.dirname(__file__)
20 22
21 _version_re = re.compile(br"^\s*__version__\s*=\s*(\"|')(.*)\1\s*(#.*)?$", 23 _version_re = re.compile(br"^\s*__version__\s*=\s*(\"|')(.*)\1\s*(#.*)?$",
22 re.MULTILINE) 24 re.MULTILINE)
65 # Otherwise some cached package_data would be used. 67 # Otherwise some cached package_data would be used.
66 # But our package data differs between "standard" builds and 68 # But our package data differs between "standard" builds and
67 # builds with "--windows-cross-pack". 69 # builds with "--windows-cross-pack".
68 # 70 #
69 71
70 if os.path.isdir("ConfigMix.egg-info"): 72 if os.path.isdir(PROJECT_NAME + ".egg-info"):
71 raise RuntimeError("please remove ConfigMix.egg-info before") 73 raise RuntimeError(
74 "please remove %s.egg-info before" % (PROJECT_NAME,))
72 75
73 # 76 #
74 # Handle the optinal C-extension for Python3.7+ and CPython only. 77 # Handle the optinal C-extension for Python3.7+ and CPython only.
75 # PyPy does not need this. 78 # PyPy does not need this.
76 # 79 #
125 else: 128 else:
126 129
127 if not os.path.isfile("configmix/_speedups.pyd"): 130 if not os.path.isfile("configmix/_speedups.pyd"):
128 raise RuntimeError("no _speedups.pyd found") 131 raise RuntimeError("no _speedups.pyd found")
129 132
130 if os.path.isdir("ConfigMix.egg-info"): 133 if os.path.isdir(PROJECT_NAME + ".egg-info"):
131 raise RuntimeError("please remove ConfigMix.egg-info before") 134 raise RuntimeError(
135 "please remove %s.egg-info before" % (PROJECT_NAME,))
132 136
133 setup_extra_kwds["package_data"] = { 137 setup_extra_kwds["package_data"] = {
134 "configmix": ["*.pyd"] 138 "configmix": ["*.pyd"]
135 } 139 }
136 140
185 setup_extra_kwds["zip_safe"] = True 189 setup_extra_kwds["zip_safe"] = True
186 if cmdclass: 190 if cmdclass:
187 setup_extra_kwds["cmdclass"] = cmdclass 191 setup_extra_kwds["cmdclass"] = cmdclass
188 192
189 setup( 193 setup(
190 name="ConfigMix", 194 name=PROJECT_NAME,
191 version=version, 195 version=version,
192 author="Franz Glasner", 196 author="Franz Glasner",
193 license='BSD 3-Clause "New" or "Revised" License', 197 license='BSD 3-Clause "New" or "Revised" License',
194 url="https://pypi.dom66.de/simple/configmix/", 198 url="https://pypi.dom66.de/simple/configmix/",
195 description="Library for extended configuration files", 199 description="Library for extended configuration files",