Browse Source

generated files no longer contain the Shore version in the remark that the file was automatically generated

master
Niklas Rosenstein 7 months ago
parent
commit
9bedd1754f
Signed by: NiklasRosenstein <rosensteinniklas@gmail.com> GPG Key ID: 06D269B33D25F6C6
4 changed files with 9 additions and 8 deletions
  1. +3
    -3
      src/shore/plugins/dev_install.py
  2. +2
    -2
      src/shore/plugins/requirements_file.py
  3. +2
    -2
      src/shore/plugins/setuptools.py
  4. +2
    -1
      src/shore/templates/dev_install/dev-install

+ 3
- 3
src/shore/plugins/dev_install.py View File

@@ -20,9 +20,9 @@
# IN THE SOFTWARE.

from pkg_resources import resource_string
from shore import __version__
from shore.core.plugins import FileToRender, IMonorepoPlugin
from shore.model import Monorepo, Package, Requirements
from shore.static import GENERATED_FILE_REMARK
from nr.databind.core import Field, Struct
from nr.interface import implements, override
from typing import Dict, Iterable, List
@@ -59,8 +59,8 @@ class DevInstallRenderer:
def write_script(_current, fp):
template = resource_string('shore', 'templates/dev_install/dev-install').decode('utf8')
content = (template
.replace('{{shore_version}}', __version__)
.replace('{{package_def}}', package_def))
.replace('{{package_def}}', package_def)
.replace('{{generated_file_remark}}', GENERATED_FILE_REMARK))
fp.write(content)

yield FileToRender(monorepo.directory,


+ 2
- 2
src/shore/plugins/requirements_file.py View File

@@ -19,9 +19,9 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

from shore import __version__
from shore.core.plugins import FileToRender, IPackagePlugin
from shore.model import Package
from shore.static import GENERATED_FILE_REMARK
from nr.interface import implements, override
from typing import Dict, Iterable
import json
@@ -34,7 +34,7 @@ class RequirementsFileRenderer:
@override
def get_package_files(self, package: Package) -> Iterable[FileToRender]:
def _render_requirements(_current, fp):
fp.write('# automatically created by shore {}\n'.format(__version__))
fp.write(GENERATED_FILE_REMARK + '\n')
for req in package.requirements.required:
fp.write(req.to_setuptools() + '\n')
yield FileToRender(package.directory, 'requirements.txt', _render_requirements)

+ 2
- 2
src/shore/plugins/setuptools.py View File

@@ -24,7 +24,6 @@ plugin is used by default in packages. """

from ._util import find_readme_file, Readme
from nr.interface import implements, override
from shore import __version__
from shore.core.plugins import (
BuildResult,
CheckResult,
@@ -33,6 +32,7 @@ from shore.core.plugins import (
IPackagePlugin,
VersionRef)
from shore.model import Package
from shore.static import GENERATED_FILE_REMARK
from typing import Iterable, Optional
import contextlib
import json
@@ -173,7 +173,7 @@ class SetuptoolsRenderer:
has_develop_hooks = any(x.event in ('before-develop', 'develop') for x in package.install_hooks)

# Write the header/imports.
fp.write('# automatically created by shore {}\n\n'.format(__version__))
fp.write(GENERATED_FILE_REMARK + '\n')
if has_hooks or has_install_hooks:
fp.write('from setuptools.command.install import install as _install_command\n')
if has_hooks or has_develop_hooks:


+ 2
- 1
src/shore/templates/dev_install/dev-install View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
# automatically created by shore {{shore_version}}
#####################
{{generated_file_remark}}

from __future__ import print_function
import argparse


Loading…
Cancel
Save