From e5e766fe40a16a9c70d50fdf67993b88afcefa8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 26 Jul 2015 23:54:03 +0200 Subject: [PATCH 1/3] Replace dashes with underscores in package name. Closes #23. --- hooks/post_gen_project.py | 2 +- {{cookiecutter.repo_name}}/.bumpversion.cfg | 2 +- {{cookiecutter.repo_name}}/ci/templates/tox.ini | 2 +- {{cookiecutter.repo_name}}/docs/reference/index.rst | 2 +- .../docs/reference/{{cookiecutter.package_name}}.rst | 6 +++--- {{cookiecutter.repo_name}}/docs/usage.rst | 2 +- {{cookiecutter.repo_name}}/setup.cfg | 6 +++--- {{cookiecutter.repo_name}}/setup.py | 2 +- .../__init__.py | 0 .../__main__.py | 0 {{cookiecutter.repo_name}}/tox.ini | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) rename {{cookiecutter.repo_name}}/src/{{{cookiecutter.package_name}} => {{cookiecutter.package_name.replace('-','_')}}}/__init__.py (100%) rename {{cookiecutter.repo_name}}/src/{{{cookiecutter.package_name}} => {{cookiecutter.package_name.replace('-','_')}}}/__main__.py (100%) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9d9bd4cb..0b56db30 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -22,7 +22,7 @@ import os {%- if cookiecutter.command_line_interface|lower == 'no' %} - os.unlink(join('src', '{{ cookiecutter.package_name }}', '__main__.py')) + os.unlink(join('src', '{{ cookiecutter.package_name|replace('-', '_') }}', '__main__.py')) {% endif %} {%- if cookiecutter.test_matrix_configurator|lower == 'no' %} diff --git a/{{cookiecutter.repo_name}}/.bumpversion.cfg b/{{cookiecutter.repo_name}}/.bumpversion.cfg index e66ab38d..a26d022a 100644 --- a/{{cookiecutter.repo_name}}/.bumpversion.cfg +++ b/{{cookiecutter.repo_name}}/.bumpversion.cfg @@ -5,4 +5,4 @@ tag = True [bumpversion:file:setup.py] [bumpversion:file:docs/conf.py] -[bumpversion:file:src/{{ cookiecutter.package_name }}/__init__.py] +[bumpversion:file:src/{{ cookiecutter.package_name|replace('-', '_') }}/__init__.py] diff --git a/{{cookiecutter.repo_name}}/ci/templates/tox.ini b/{{cookiecutter.repo_name}}/ci/templates/tox.ini index e42be25f..620ae43a 100644 --- a/{{cookiecutter.repo_name}}/ci/templates/tox.ini +++ b/{{cookiecutter.repo_name}}/ci/templates/tox.ini @@ -141,7 +141,7 @@ commands = {%- if cookiecutter.test_runner|lower == "pytest" %} {posargs:py.test --cov --cov-report=term-missing -vv} {%- else %} - {posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name }}} + {posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name|replace('-', '_') }}} {%- endif %} {%- raw %} {% endif %} diff --git a/{{cookiecutter.repo_name}}/docs/reference/index.rst b/{{cookiecutter.repo_name}}/docs/reference/index.rst index 67a2e6f3..3e267eeb 100644 --- a/{{cookiecutter.repo_name}}/docs/reference/index.rst +++ b/{{cookiecutter.repo_name}}/docs/reference/index.rst @@ -4,4 +4,4 @@ Reference .. toctree:: :glob: - {{cookiecutter.package_name}}* + {{ cookiecutter.package_name|replace('-', '_') }}* diff --git a/{{cookiecutter.repo_name}}/docs/reference/{{cookiecutter.package_name}}.rst b/{{cookiecutter.repo_name}}/docs/reference/{{cookiecutter.package_name}}.rst index 16716903..541a7e6f 100644 --- a/{{cookiecutter.repo_name}}/docs/reference/{{cookiecutter.package_name}}.rst +++ b/{{cookiecutter.repo_name}}/docs/reference/{{cookiecutter.package_name}}.rst @@ -1,5 +1,5 @@ -{{cookiecutter.package_name}} -============================= +{{ cookiecutter.package_name|replace('-', '_') }} +{{ "=" * cookiecutter.package_name|length }} -.. automodule:: {{cookiecutter.package_name}} +.. automodule:: {{ cookiecutter.package_name|replace('-', '_') }} :members: diff --git a/{{cookiecutter.repo_name}}/docs/usage.rst b/{{cookiecutter.repo_name}}/docs/usage.rst index 8b2def1b..a8e772b4 100644 --- a/{{cookiecutter.repo_name}}/docs/usage.rst +++ b/{{cookiecutter.repo_name}}/docs/usage.rst @@ -4,4 +4,4 @@ Usage To use {{ cookiecutter.project_name }} in a project:: - import {{ cookiecutter.package_name }} + import {{ cookiecutter.package_name|replace('-', '_') }} diff --git a/{{cookiecutter.repo_name}}/setup.cfg b/{{cookiecutter.repo_name}}/setup.cfg index aa0d5543..c1194283 100644 --- a/{{cookiecutter.repo_name}}/setup.cfg +++ b/{{cookiecutter.repo_name}}/setup.cfg @@ -36,9 +36,9 @@ addopts = [isort] force_single_line=True line_length=120 -known_first_party={{ cookiecutter.package_name }} +known_first_party={{ cookiecutter.package_name|replace('-', '_') }} default_section=THIRDPARTY -forced_separate=test_{{ cookiecutter.package_name }} +forced_separate=test_{{ cookiecutter.package_name|replace('-', '_') }} {%- if cookiecutter.test_matrix_configurator|lower == "yes" %} [matrix] @@ -82,4 +82,4 @@ coverage_flags = environment_variables = - -{% endif %} \ No newline at end of file +{% endif %} diff --git a/{{cookiecutter.repo_name}}/setup.py b/{{cookiecutter.repo_name}}/setup.py index 1d4b4b87..1193b542 100644 --- a/{{cookiecutter.repo_name}}/setup.py +++ b/{{cookiecutter.repo_name}}/setup.py @@ -117,7 +117,7 @@ def _unavailable(self, e): {%- if cookiecutter.command_line_interface|lower in ['plain', 'click'] %} entry_points={ 'console_scripts': [ - '{{ cookiecutter.distribution_name }} = {{ cookiecutter.package_name }}.__main__:main', + '{{ cookiecutter.distribution_name }} = {{ cookiecutter.package_name|replace('-', '_') }}.__main__:main', ] }, {%- endif %} diff --git a/{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/__init__.py b/{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name.replace('-','_')}}/__init__.py similarity index 100% rename from {{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/__init__.py rename to {{cookiecutter.repo_name}}/src/{{cookiecutter.package_name.replace('-','_')}}/__init__.py diff --git a/{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/__main__.py b/{{cookiecutter.repo_name}}/src/{{cookiecutter.package_name.replace('-','_')}}/__main__.py similarity index 100% rename from {{cookiecutter.repo_name}}/src/{{cookiecutter.package_name}}/__main__.py rename to {{cookiecutter.repo_name}}/src/{{cookiecutter.package_name.replace('-','_')}}/__main__.py diff --git a/{{cookiecutter.repo_name}}/tox.ini b/{{cookiecutter.repo_name}}/tox.ini index 2974a3b2..e6ca92bb 100644 --- a/{{cookiecutter.repo_name}}/tox.ini +++ b/{{cookiecutter.repo_name}}/tox.ini @@ -54,7 +54,7 @@ commands = {%- if cookiecutter.test_runner|lower == "pytest" %} {posargs:py.test --cov --cov-report=term-missing -vv} {%- else %} - {posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name }}} + {posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name|replace('-', '_') }}} {%- endif %} usedevelop = true From 3b5945bc273cc79183c01176969b47ee5069df65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 27 Jul 2015 13:48:45 +0300 Subject: [PATCH 2/3] Also exclude *.dylib --- {{cookiecutter.repo_name}}/MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/MANIFEST.in b/{{cookiecutter.repo_name}}/MANIFEST.in index 33a4802c..49b230a8 100644 --- a/{{cookiecutter.repo_name}}/MANIFEST.in +++ b/{{cookiecutter.repo_name}}/MANIFEST.in @@ -18,4 +18,4 @@ include README.rst include tox.ini .travis.yml appveyor.yml -global-exclude *.py[cod] __pycache__ *.so +global-exclude *.py[cod] __pycache__ *.so *.dylib From 4ac33f3d8e57fb49f31a0232f63c8738cab0038e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 27 Jul 2015 13:53:36 +0300 Subject: [PATCH 3/3] Fix wrong path and missing passenv in the tox.ini template. Closes #24. --- {{cookiecutter.repo_name}}/ci/templates/tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/ci/templates/tox.ini b/{{cookiecutter.repo_name}}/ci/templates/tox.ini index 620ae43a..4528e0de 100644 --- a/{{cookiecutter.repo_name}}/ci/templates/tox.ini +++ b/{{cookiecutter.repo_name}}/ci/templates/tox.ini @@ -59,7 +59,9 @@ deps = matrix skip_install = true commands = - python bootstrap.py + python ci/bootstrap.py +passenv = + * [testenv:check] basepython = python3.4