1414import os
1515import sys
1616from os .path import dirname , join as pjoin
17- from setuptools import setup , find_packages , Command
17+ from glob import glob
18+ from setuptools import Command , setup
1819from setuptools .command .test import test as TestCommand
1920
20-
21- meta = {}
22- with open (pjoin ('icecream' , '__version__.py' )) as f :
23- exec (f .read (), meta )
24-
21+ this_dir = dirname (__file__ )
2522
2623class Publish (Command ):
2724 """Publish to PyPI with twine."""
@@ -34,11 +31,10 @@ def finalize_options(self):
3431 pass
3532
3633 def run (self ):
37- os .system ('python setup.py sdist bdist_wheel' )
38-
39- sdist = 'dist/icecream-%s.tar.gz' % meta ['__version__' ]
40- wheel = 'dist/icecream-%s-py2.py3-none-any.whl' % meta ['__version__' ]
41- rc = os .system ('twine upload "%s" "%s"' % (sdist , wheel ))
34+ dist_dir = pjoin (this_dir , "dist" )
35+ os .system (sys .executable + " -m build -nwxs " + this_dir )
36+ files = glob (pjoin (dist_dir , "*.whl" )) + glob (pjoin (dist_dir , "*.tar.gz" ))
37+ rc = os .system (sys .executable + " -m twine upload " + " " .join (files ))
4238
4339 sys .exit (rc )
4440
@@ -59,51 +55,13 @@ class RunTests(TestCommand):
5955 """
6056 def run_tests (self ):
6157 from unittest import TestLoader , TextTestRunner
62- tests_dir = pjoin (dirname ( __file__ ) , 'tests' )
58+ tests_dir = pjoin (this_dir , 'tests' )
6359 suite = TestLoader ().discover (tests_dir )
6460 result = TextTestRunner ().run (suite )
6561 sys .exit (0 if result .wasSuccessful () else - 1 )
6662
6763
6864setup (
69- name = meta ['__title__' ],
70- license = meta ['__license__' ],
71- version = meta ['__version__' ],
72- author = meta ['__author__' ],
73- author_email = meta ['__contact__' ],
74- url = meta ['__url__' ],
75- description = meta ['__description__' ],
76- long_description = (
77- 'Information and documentation can be found at '
78- 'https://github.com/gruns/icecream.' ),
79- platforms = ['any' ],
80- packages = find_packages (),
81- include_package_data = True ,
82- classifiers = [
83- 'License :: OSI Approved :: MIT License' ,
84- 'Natural Language :: English' ,
85- 'Intended Audience :: Developers' ,
86- 'Topic :: Software Development :: Libraries' ,
87- 'Development Status :: 4 - Beta' ,
88- 'Programming Language :: Python' ,
89- 'Programming Language :: Python :: 2' ,
90- 'Programming Language :: Python :: 2.7' ,
91- 'Programming Language :: Python :: 3' ,
92- 'Programming Language :: Python :: 3.5' ,
93- 'Programming Language :: Python :: 3.6' ,
94- 'Programming Language :: Python :: 3.7' ,
95- 'Programming Language :: Python :: 3.8' ,
96- 'Programming Language :: Python :: 3.9' ,
97- 'Programming Language :: Python :: Implementation :: PyPy' ,
98- 'Programming Language :: Python :: Implementation :: CPython' ,
99- ],
100- tests_require = [],
101- install_requires = [
102- 'colorama>=0.3.9' ,
103- 'pygments>=2.2.0' ,
104- 'executing>=0.3.1' ,
105- 'asttokens>=2.0.1' ,
106- ],
10765 cmdclass = {
10866 'test' : RunTests ,
10967 'publish' : Publish ,
0 commit comments