Skip to content

Commit

Permalink
use single version number
Browse files Browse the repository at this point in the history
  • Loading branch information
scottprahl committed Mar 10, 2022
1 parent e9b6651 commit 97abbb6
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=================================================

v1.9.1
------
* centralize version number to a single place

v1.9.0
------
* add beam_ellipticity()
Expand Down
19 changes: 15 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import os.path
import sphinx_rtd_theme

def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, rel_path), 'r', encoding='utf-8') as fp:
return fp.read()

def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

Expand All @@ -15,9 +28,7 @@
copyright = '2017-22, Scott Prahl'
author = 'Scott Prahl'

# The full version, including alpha/beta/rc tags
release = '1.9.0'

release = get_version("../laserbeamsize/__init__.py")
master_doc = 'index'

# -- General configuration ---------------------------------------------------
Expand Down
Binary file modified docs/sbfit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion laserbeamsize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
from .laserbeamsize import *
from .m2 import *

__version__ = '1.9.0'
__version__ = '1.9.1'
6 changes: 2 additions & 4 deletions release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ Releasing a new version
# check
make rcheck

# update the version in three different places!
# setup.cfg docs/conf.py laserbeamsize/__init__.py

git commit -m 'update version' setup.cfg docs/conf.py
# update the version in __init__.py
git commit -m 'update version' laserbeamsize/__init__.py

# update CHANGELOG.rst `git shortlog v1.9.0..HEAD`
git commit -m 'update recent changes' CHANGELOG.rst
Expand Down
Binary file modified sbfit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[metadata]
name = laserbeamsize
version = 1.9.0
author = Scott Prahl
author_email = scott.prahl@oit.edu
license = MIT
Expand Down
24 changes: 16 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import os.path
from setuptools import setup

# use README.rst as the long description
# make sure to use the syntax that works in both ReST and markdown
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, rel_path), 'r', encoding='utf-8') as fp:
return fp.read()

def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")

setup(
long_description=long_description,
long_description_content_type='text/x-rst'
long_description = read('README.rst'),
long_description_content_type = 'text/x-rst',
version = get_version("laserbeamsize/__init__.py")
)

0 comments on commit 97abbb6

Please sign in to comment.