Skip to content

Commit

Permalink
Changes to source package and directory cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Jan 15, 2019
1 parent f05c8cb commit cd01ae7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions l2tdevtools/source_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,35 +265,36 @@ def Clean(self):
return

filenames_to_ignore = re.compile(
'^{0:s}-.*{1!s}'.format(self.project_name, project_version))
'^{0:s}-(|experimental-|alpha-|beta-){1!s}'.format(
self.project_name, project_version))

# Remove previous versions of source packages in the format:
# project-*.tar.gz
filenames = glob.glob('{0:s}-*.tar.gz'.format(self.project_name))
filenames = glob.glob('{0:s}-[0-9]*.tar.gz'.format(self.project_name))
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)

# Remove previous versions of source packages in the format:
# project-*.tgz
filenames = glob.glob('{0:s}-*.tgz'.format(self.project_name))
filenames = glob.glob('{0:s}-[0-9]*.tgz'.format(self.project_name))
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)

# Remove previous versions of source packages in the format:
# project-*.zip
filenames = glob.glob('{0:s}-*.zip'.format(self.project_name))
filenames = glob.glob('{0:s}-[0-9]*.zip'.format(self.project_name))
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)

# Remove previous versions of source directories in the format:
# project-{version}
filenames = glob.glob('{0:s}-*'.format(self.project_name))
filenames = glob.glob('{0:s}-[0-9]*'.format(self.project_name))
for filename in filenames:
if os.path.isdir(filename) and not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
Expand Down

0 comments on commit cd01ae7

Please sign in to comment.