Skip to content

Commit

Permalink
Merge pull request #166 from RonnyPfannschmidt/enhanced-self-use
Browse files Browse the repository at this point in the history
allow unprepared self-use
  • Loading branch information
RonnyPfannschmidt authored Apr 8, 2017
2 parents 34125b8 + f46e7d7 commit 00f3fbe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v1.15.4
=======

* fix issue #164: iterate all found entry points to avoid erros when pip remakes egg-info
* enhance self-use to enable pip install from github again

v1.15.3
=======
Expand Down
47 changes: 22 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,47 @@
import setuptools


PROBLEMATIC_COMMANDS = 'install', 'develop', 'easy_install', 'bdist_egg'

if not os.path.isdir('setuptools_scm.egg-info'):
print(__doc__)

if any(c in sys.argv for c in PROBLEMATIC_COMMANDS):
sys.exit('please run `python setup.py egg_info` first')


def _find_hackish_version():
def scm_config():
here = os.path.dirname(os.path.abspath(__file__))
egg_info = os.path.join(here, 'setuptools_scm.egg-info')
has_entrypoints = os.path.isdir(egg_info)

sys.path.insert(0, here)
from setuptools_scm.hacks import parse_pkginfo
from setuptools_scm import get_version
try:
return get_version(
root=here, parse=parse_pkginfo,
**scm_config())
except IOError:
pass


def scm_config():
from setuptools_scm.git import parse as parse_git
from setuptools_scm.version import (

guess_next_dev_version,
get_local_node_and_date,
)
return dict(

def parse(root):
try:
return parse_pkginfo(root)
except IOError:
return parse_git(root)

config = dict(
version_scheme=guess_next_dev_version,
local_scheme=get_local_node_and_date,
)

if has_entrypoints:
return dict(use_scm_version=config)
else:
from setuptools_scm import get_version
return dict(version=get_version(
root=here, parse=parse, **config))


with open('README.rst') as fp:
long_description = fp.read()

found_version = _find_hackish_version()

arguments = dict(
name='setuptools_scm',
url='https://github.com/pypa/setuptools_scm/',
zip_safe=True,
version=found_version,
# pass here since entrypints are not yet registred
use_scm_version=found_version is None and scm_config,
author='Ronny Pfannschmidt',
author_email='[email protected]',
description=('the blessed package to manage your versions by scm tags'),
Expand Down Expand Up @@ -116,4 +112,5 @@ def scm_config():
)

if __name__ == '__main__':
arguments.update(scm_config())
setuptools.setup(**arguments)

0 comments on commit 00f3fbe

Please sign in to comment.