Skip to content

Commit

Permalink
The installation instructions failed for two reasons:
Browse files Browse the repository at this point in the history
1. python 3.12 has removed the `imp` module and has replaced it by the `importlib` module. [1](https://docs.python.org/3/whatsnew/3.12.html#imp)
2. the use of setup.py as in the command `python setup.py install` is deprecated and should be replaced by the recommended way of `python -m pip install path/to/project`. [2](https://packaging.python.org/en/latest/discussions/setup-py-deprecated/)
  • Loading branch information
crnkv committed May 9, 2024
1 parent 01fa324 commit 1c1f982
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,18 @@ You may either download the [stable](https://github.com/soimort/you-get/archive/
Alternatively, run

```
$ [sudo] python3 setup.py install
$ cd path/to/you-get
$ [sudo] python -m pip install .
```

Or

```
$ python3 setup.py install --user
$ cd path/to/you-get
$ python -m pip install . --user
```

to install `you-get` to a permanent path.
to install `you-get` to a permanent path. (And don't omit the dot `.` representing the current directory)

You can also use the [pipenv](https://pipenv.pypa.io/en/latest) to install the `you-get` in the Python virtual environment.

Expand All @@ -107,7 +109,7 @@ This is the recommended way for all developers, even if you don't often code in
$ git clone git://github.com/soimort/you-get.git
```

Then put the cloned directory into your `PATH`, or run `./setup.py install` to install `you-get` to a permanent path.
Then put the cloned directory into your `PATH`, or run `python -m pip install path/to/you-get` to install `you-get` to a permanent path.

### Option 5: Homebrew (Mac only)

Expand Down
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,28 @@

PROJ_METADATA = '%s.json' % PROJ_NAME

import os, json, imp
import importlib.util
import importlib.machinery

def load_source(modname, filename):
loader = importlib.machinery.SourceFileLoader(modname, filename)
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
module = importlib.util.module_from_spec(spec)
# The module is always executed and not cached in sys.modules.
# Uncomment the following line to cache the module.
# sys.modules[module.__name__] = module
loader.exec_module(module)
return module

import os, json
here = os.path.abspath(os.path.dirname(__file__))
proj_info = json.loads(open(os.path.join(here, PROJ_METADATA), encoding='utf-8').read())
try:
README = open(os.path.join(here, 'README.rst'), encoding='utf-8').read()
except:
README = ""
CHANGELOG = open(os.path.join(here, 'CHANGELOG.rst'), encoding='utf-8').read()
VERSION = imp.load_source('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)).__version__
VERSION = load_source('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)).__version__

from setuptools import setup, find_packages
setup(
Expand Down

0 comments on commit 1c1f982

Please sign in to comment.