Skip to content

Commit

Permalink
Updates for v0.6.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccafair committed Jul 2, 2021
1 parent f074c62 commit 61f62c1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
`Unreleased <https://github.com/pace-neutrons/Euphonic/compare/v0.5.2...HEAD>`_
`Unreleased <https://github.com/pace-neutrons/Euphonic/compare/v0.6.0...HEAD>`_
----------

`v0.6.0 <https://github.com/pace-neutrons/Euphonic/compare/v0.5.2...0.6.0>`_
------

- Euphonic can now calculate neutron-weighted partial density of states, and
has new ``Spectra`` features to handle PDOS data:

Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ authors:
- family-names: "Voneshen"
given-names: "D. J."
title: "Euphonic"
version: "0.5.2"
date-released: "2021-06-02"
version: "0.6.0"
date-released: "2021-07-02"
license: "GPL-3.0-only"
repository: "https://github.com/pace-neutrons/Euphonic"
url: "euphonic.readthedocs.io/en/latest"
Expand Down
27 changes: 18 additions & 9 deletions release.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import re
import requests
import subprocess
from importlib_resources import open_text
import yaml
from euphonic import __version__


Expand All @@ -22,20 +24,27 @@ def main():
def release_github(test=True):
with open('CHANGELOG.rst') as f:
changelog = f.read()
with open('CITATION.cff') as f:
citation = yaml.safe_load(f)

euphonic_ver = 'v' + __version__
changelog_ver = re.findall('\n`(v\d+\.\d+\.\S+)\s', changelog)[0]
if euphonic_ver != changelog_ver:
raise Exception((
f'euphonic.__version__/changelog.rst version mismatch! '
f'euphonic.__version__: {euphonic_ver} changelog.rst: '
f'{changelog_ver}'))
version_dict = {}
version_dict['CHANGELOG.rst'] = re.findall('\n`(v\d+\.\d+\.\S+)\s',
changelog)[0]
version_dict['CITATION.cff'] = 'v' + citation['version']
for ver_name, ver in version_dict.items():
if euphonic_ver != ver:
raise Exception((
f'euphonic.__version__/{ver_name} version mismatch! '
f'euphonic.__version__: {euphonic_ver} {ver_name}: '
f'{ver}'))

desc = re.search('`v\d+\.\d+\.\S+.*?^-+\n(.*?)^`v', changelog,
re.DOTALL | re.MULTILINE).groups()[0].strip()

payload = {
"tag_name": changelog_ver,
"tag_name": euphonic_ver,
"target_commitish": "master",
"name": changelog_ver,
"name": euphonic_ver,
"body": desc,
"draft": False,
"prerelease": True
Expand Down
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ def get_c_extension():
def run_setup():

license_file = 'LICENSE'

# A list of files outside the Euphonic package directory that should
# be included in the installation in site-packages. They must
# also be added to MANIFEST.in
ex_install_files = [license_file,
'CITATION.cff']
# MANIFEST.in will add any included files to the site-packages
# installation, but only if they are inside the package directory,
# so temporarily copy them there
# so temporarily copy them there if needed
for ex_install_file in ex_install_files:
try:
shutil.copy(ex_install_file, 'euphonic')
Expand Down Expand Up @@ -147,9 +146,13 @@ def run_setup():
)

for ex_install_file in ex_install_files:
try:
os.remove(os.path.join('euphonic', ex_install_file))
except (PermissionError, OSError) as err:
warnings.warn(f'{err}', stacklevel=2)
# Only delete file if there is another copy in the current dir
# (e.g. from a git clone) in a PyPI dist the only copy will be
# in the euphonic subdir, we don't want to delete that!
if os.path.isfile(ex_install_file):
try:
os.remove(os.path.join('euphonic', ex_install_file))
except (PermissionError, OSError, FileNotFoundError) as err:
warnings.warn(f'{err}', stacklevel=2)

run_setup()

0 comments on commit 61f62c1

Please sign in to comment.