Skip to content

Commit

Permalink
Merge 0057d47 into b224e01
Browse files Browse the repository at this point in the history
  • Loading branch information
peti committed Jan 12, 2018
2 parents b224e01 + 0057d47 commit 946bfa5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 4 additions & 0 deletions spec_cleaner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import sys
import argparse
from datetime import datetime

from .rpmexception import RpmWrongArgs, RpmException
from .rpmcleaner import RpmSpecCleaner
Expand Down Expand Up @@ -46,6 +47,8 @@ def process_args(argv):
help='do not convert variables bracketing (%%{macro}) and keep it as it was on the input')
parser.add_argument('--no-copyright', action='store_true',
help='do not include official SUSE copyright hear and just keep what is present')
parser.add_argument('--copyright-year', metavar='YYYY', type=int, default=datetime.now().year,
help='year to insert into the copyright header when re-generating it')
output_group.add_argument('-o', '--output', default='',
help='specify the output file for the cleaned spec content.')
parser.add_argument('-p', '--pkgconfig', action='store_true',
Expand Down Expand Up @@ -88,6 +91,7 @@ def process_args(argv):
'minimal': options.minimal,
'no_curlification': options.no_curlification,
'no_copyright': options.no_copyright,
'copyright_year': options.copyright_year,
'perl': options.perl,
'tex': options.tex,
'cmake': options.cmake,
Expand Down
4 changes: 2 additions & 2 deletions spec_cleaner/rpmcopyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RpmCopyright(Section):
def __init__(self, options):
Section.__init__(self, options)
self.no_copyright = options['no_copyright']
self.year = options['copyright_year']
self.copyrights = []
self.buildrules = []
self.my_copyright = ''
Expand All @@ -29,8 +30,7 @@ def _add_pkg_header(self):
#'''.format(specname))

def _create_default_copyright(self):
year = datetime.date.today().year
self.my_copyright = '# Copyright (c) {0} SUSE LINUX GmbH, Nuernberg, Germany.'.format(year)
self.my_copyright = '# Copyright (c) {0} SUSE LINUX GmbH, Nuernberg, Germany.'.format(self.year)

def _add_copyright(self):
self._create_default_copyright()
Expand Down
9 changes: 1 addition & 8 deletions tests/acceptance-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
from spec_cleaner import RpmException
from spec_cleaner import RpmSpecCleaner


class NewDate(datetime.date):
@classmethod
def today(cls):
return cls(2013, 1, 1)

datetime.date = NewDate

class TestCompare(object):

"""
Expand All @@ -34,6 +26,7 @@ class TestCompare(object):
'minimal': False,
'no_curlification': False,
'no_copyright': True,
'copyright_year': 2013,
'tex': False,
'perl': False,
'cmake': False,
Expand Down

0 comments on commit 946bfa5

Please sign in to comment.