diff --git a/.coveragerc b/.coveragerc index 77c2ecb..9942f59 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,7 +5,6 @@ source = omit = .tox/* /usr/* - setup.py # Don't complain if non-runnable code isn't run */__main__.py diff --git a/.gitignore b/.gitignore index e10547b..2ba161b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -.coverage +.coverage* *.pyc *.pyo *.swp *.swo env env-dev -/nodeenv +/nodeenv-env /TODO /build/ /dist/ diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index daa88db..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include README LICENSE CHANGES AUTHORS -include *.py *.rst setup.cfg Makefile - -graft debian-upstream -prune debian-upstream/nodeenv -prune debian-upstream/sdist -recursive-exclude debian-upstream *.log *.substvars files diff --git a/Makefile b/Makefile index f2f67cb..8458700 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: default deploy deploy-github deploy-pypi update-pypi clean tests env TEST_ENV=env DEV_TEST_ENV=env-dev -SETUP=python setup.py install > /dev/null +SETUP=pip install -q . > /dev/null default: : do nothing when dpkg-buildpackage runs this project Makefile @@ -12,20 +12,18 @@ deploy-github: deploy-pypi: rm -rf dist - python setup.py sdist bdist_wheel + python -m build twine upload --repository pypi dist/* update-pypi: - python setup.py register + twine register deploy: contributors deploy-github deploy-pypi clean: - @rm -rf nodeenv.egg-info/ @rm -rf dist/ - @rm -rf build/ @rm -rf ${TEST_ENV}/ - @rm -rf nodeenv/ + @rm -rf nodeenv-env/ clean-test-env: @rm -rf ${TEST_ENV} @@ -37,38 +35,38 @@ setup-test-env: env: clean-test-env setup-test-env @. ${TEST_ENV}/bin/activate && \ - python setup.py install + pip install . # https://virtualenv.pypa.io/en/legacy/reference.html#cmdoption-no-site-packages # https://github.com/pypa/virtualenv/issues/1681 env-dev: - @rm -rf ${DEV_TEST_ENV} && \ - virtualenv ${DEV_TEST_ENV} && \ - . ${DEV_TEST_ENV}/bin/activate && \ + @rm -rf ${DEV_TEST_ENV} && \ + virtualenv ${DEV_TEST_ENV} && \ + . ${DEV_TEST_ENV}/bin/activate && \ pip install -r requirements-dev.txt test1: clean clean-test-env setup-test-env @echo " =" @echo " = test1: separate nodejs's env" @echo " =" - @. ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ - nodeenv -j 4 nodeenv + @. ${TEST_ENV}/bin/activate && \ + ${SETUP} && \ + nodeenv -j 4 nodeenv-env test2: clean clean-test-env setup-test-env @echo " =" @echo " = test2: the same virtualenv's env, with 4 jobs" @echo " =" - @. ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ + @. ${TEST_ENV}/bin/activate && \ + ${SETUP} && \ nodeenv -j 4 -p test3: clean clean-test-env setup-test-env @echo " =" @echo " = test3: the same virtualenv's env, without any params" @echo " =" - @. ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ + @. ${TEST_ENV}/bin/activate && \ + ${SETUP} && \ nodeenv -p # https://github.com/ekalinin/nodeenv/issues/43 @@ -76,9 +74,9 @@ test4: clean clean-test-env @echo " =" @echo " = test4: system nodejs's for python3.9" @echo " =" - @virtualenv --python=python3.9 ${TEST_ENV} && \ - . ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ + @virtualenv --python=python3.9 ${TEST_ENV} && \ + . ${TEST_ENV}/bin/activate && \ + ${SETUP} && \ nodeenv -p --node=system test5: clean clean-test-env @@ -87,7 +85,7 @@ test5: clean clean-test-env @echo " =" @virtualenv --python=python2.7 ${TEST_ENV} && \ . ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ + ${SETUP} && \ nodeenv -p --prebuilt test7: clean clean-test-env setup-test-env @@ -98,7 +96,7 @@ test7: clean clean-test-env setup-test-env ${SETUP} && \ nodeenv -j 4 -p --prebuilt && \ . ${TEST_ENV}/bin/activate && \ - npm install -g sitemap && \ + npm install -g sitemap && \ npm -v && \ node -v && \ test "`freeze | grep -v corepack | wc -l`" = " 1"; @@ -117,10 +115,10 @@ test9: clean clean-test-env setup-test-env @echo " =" @echo " = test9: unicode paths, #187" @echo " =" - @. ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ - rm -rf "test dir" && mkdir "test dir" && cd "test dir" && \ - nodeenv -j 4 --prebuilt env && \ + @. ${TEST_ENV}/bin/activate && \ + ${SETUP} && \ + rm -rf "test dir" && mkdir "test dir" && cd "test dir" && \ + nodeenv -j 4 --prebuilt env && \ rm -rf "test dir" test10: clean clean-test-env setup-test-env @@ -128,7 +126,7 @@ test10: clean clean-test-env setup-test-env @echo " = test10: symlink does not fail if npm already exists, #189" @echo " =" @. ${TEST_ENV}/bin/activate && \ - ${SETUP} && \ + ${SETUP} && \ nodeenv -j 4 -p --prebuilt && \ nodeenv -j 4 -p --prebuilt diff --git a/debian-upstream/rules b/debian-upstream/rules index 9576c09..6ed2071 100755 --- a/debian-upstream/rules +++ b/debian-upstream/rules @@ -19,7 +19,7 @@ clean: dh $@ $(DH_VENV_ARGS) build-arch: - /usr/bin/python setup.py sdist --formats tar + /usr/bin/python -m build --sdist mkdir -p debian/sdist tar -x -C debian/sdist --strip-components=1 --exclude '*.egg-info' -f dist/*.tar dh $@ $(DH_VENV_ARGS) --sourcedir debian/sdist diff --git a/nodeenv.py b/nodeenv.py index 9d5dd06..10a67a9 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -47,7 +47,7 @@ from packaging import version -nodeenv_version = '1.8.0' +nodeenv_version = __version__ = '1.8.0' join = os.path.join abspath = os.path.abspath diff --git a/pyproject.toml b/pyproject.toml index 8fd8d67..ab8822e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,33 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] -build-backend = "setuptools.build_meta" +requires = ['flit_core >=3.2,<4'] +build-backend = 'flit_core.buildapi' + +[project] +name = 'nodeenv' +urls.Source = 'https://github.com/ekalinin/nodeenv' +license = { file = 'LICENSE' } +authors = [{ name = 'Eugene Kalinin', email = 'e.v.kalinin@gmail.com' }] +dependencies = ['packaging'] +requires-python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +description = 'Node.js virtual environment builder' +readme = 'README.rst' +classifiers = [ + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries :: Python Modules' +] +dynamic = ['version'] + +[project.scripts] +nodeenv = 'nodeenv:main' diff --git a/setup.py b/setup.py deleted file mode 100644 index e02793a..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -""" -nodeenv -~~~~~~~ - -Node.js Virtual Environment builder. -""" -import codecs -import os -import sys - -from setuptools import setup - -sys.path.insert(0, '.') - -from nodeenv import nodeenv_version - - -def read_file(file_name): - return codecs.open( - os.path.join( - os.path.dirname(os.path.abspath(__file__)), - file_name - ), - encoding='utf-8', - ).read() - - -ldesc = read_file('README.rst') -ldesc += "\n\n" + read_file('CHANGES') - -setup( - name='nodeenv', - version=nodeenv_version, - url='https://github.com/ekalinin/nodeenv', - license='BSD', - author='Eugene Kalinin', - author_email='e.v.kalinin@gmail.com', - install_requires=['packaging'], - python_requires=( - ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" - ), - description="Node.js virtual environment builder", - long_description=ldesc, - py_modules=['nodeenv'], - entry_points={ - 'console_scripts': ['nodeenv = nodeenv:main'] - }, - zip_safe=False, - platforms='any', - classifiers=[ - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries :: Python Modules' - ], - options={'bdist_wheel': {'universal': True}}, -) diff --git a/tox.ini b/tox.ini index 4fea8e0..8f1aad5 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ setenv = LANG=en_US.UTF-8 commands = coverage run -p -m pytest {posargs:tests} - flake8 --extend-ignore=E127 nodeenv.py tests setup.py + flake8 --extend-ignore=E127 nodeenv.py tests [testenv:venv] envdir = venv-nodeenv