Skip to content

Commit

Permalink
Switch to packaging (#338)
Browse files Browse the repository at this point in the history
* Switch to packaging

* install package

* fix

* support isolated builds
  • Loading branch information
flying-sheep committed Oct 5, 2023
1 parent 4ae75e3 commit 441de9c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade tox
# build and test dependencies
python -m pip install --upgrade pip wheel tox
# runtime dependencies
python -m pip install -e .
- name: Run tox targets for ${{ matrix.python-version }}
run: |
Expand Down
14 changes: 7 additions & 7 deletions nodeenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import http
IncompleteRead = http.client.IncompleteRead

from pkg_resources import parse_version
from packaging import version

nodeenv_version = '1.8.0'

Expand Down Expand Up @@ -177,9 +177,9 @@ def node_version_from_args(args):
if args.node == 'system':
out, err = subprocess.Popen(
["node", "--version"], stdout=subprocess.PIPE).communicate()
return parse_version(clear_output(out).replace('v', ''))
return version.parse(clear_output(out).replace('v', ''))

return parse_version(args.node)
return version.parse(args.node)


def create_logger():
Expand Down Expand Up @@ -519,9 +519,9 @@ def callit(cmd, show_stdout=True, in_shell=False,
return proc.returncode, all_output


def get_root_url(version):
if parse_version(version) > parse_version("0.5.0"):
return '%s/v%s/' % (src_base_url, version)
def get_root_url(version_str):
if version.parse(version_str) > version.parse("0.5.0"):
return '%s/v%s/' % (src_base_url, version_str)
else:
return src_base_url

Expand Down Expand Up @@ -1004,7 +1004,7 @@ def create_environment(env_dir, args):
# before npm install, npm use activate
# for install
install_activate(env_dir, args)
if node_version_from_args(args) < parse_version("0.6.3") or args.with_npm:
if node_version_from_args(args) < version.parse("0.6.3") or args.with_npm:
instfunc = install_npm_win if is_WIN or is_CYGWIN else install_npm
instfunc(env_dir, src_dir, args)
if args.requirements:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
"""
import codecs
import os
import sys

from nodeenv import nodeenv_version
from setuptools import setup

sys.path.insert(0, '.')

from nodeenv import nodeenv_version


def read_file(file_name):
return codecs.open(
Expand All @@ -32,7 +36,7 @@ def read_file(file_name):
license='BSD',
author='Eugene Kalinin',
author_email='e.v.kalinin@gmail.com',
install_requires=['setuptools'],
install_requires=['packaging'],
python_requires=(
">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"
),
Expand Down

0 comments on commit 441de9c

Please sign in to comment.