Skip to content

Commit 28e8136

Browse files
committed
Fix build
1 parent dbec201 commit 28e8136

29 files changed

+102
-108
lines changed

README.md

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -150,58 +150,6 @@ We have added some custom functionality to pytest which can be enabled to launch
150150

151151
* Pytest-django forces `settings.DEBUG` to `False` in `pytest_django/plugin.py`. To set `settings.DEBUG`, override it close to where it will be read, e.g., wit `@django.test.override_settings(DEBUG=True)`.
152152

153-
### Creating a new release
154-
155-
The stack should pass all the tests with the most recent available versions of all the dependencies.
156-
157-
$ cd d1_python
158-
$ sudo ./dev_tools/src/d1_dev/pip-update-all.py
159-
160-
The DataONE Python stack specifies fixed versions of all its dependencies. This ensures that a stack deployed to production matches one that passed the tests. As updating the versions in the `setup.py` files manually is time consuming and error prone, a script is included that automates the task. The script updates the version information for the dependencies in the `setup.py` files to match the versions of the currently installed dependencies. Run the script with:
161-
162-
$ cd d1_python
163-
$ src-sync-dependencies.py . <version>
164-
165-
The `<version>` argument specifies what the version will be for the release. E.g., `"2.3.1"`. We keep the version numbers in sync between all of the packages in the d1_python git repository, so only one version string needs to be specified.
166-
167-
Check that there are no package version conflicts:
168-
169-
$ pip check
170-
171-
Some sample files contain the version tag and must be updated when the version changes.
172-
173-
$ pytest --sample-ask
174-
175-
Commit and push the changes, and check the build on Travis.
176-
177-
After successful build, clone a fresh copy, which will be used for building the release packages:
178-
179-
$ cd ~
180-
$ git clone [email protected]:DataONEorg/d1_python.git d1_python_build
181-
182-
Building the release packages from a fresh clone is a simple way of ensuring that only tracked files are released. It is a workaround for the way setuptools works, which is basically that it vacuums up everything that looks like a Python script in anything that looks like a package, which makes it easy to publish local files by accident.
183-
184-
Build and publish the packages:
185-
186-
cd ~/d1_python_build
187-
setup-all.py --root . build sdist bdist_wheel
188-
189-
190-
191-
192-
#### Update the setup.py files
193-
194-
195-
#### Build the new packages
196-
197-
$ clean-tree.py
198-
$ setup-all.py sdist bdist_wheel
199-
200-
#### Push the new packages to PyPI
201-
202-
TODO
203-
204-
205153
### Setting up the development environment
206154

207155
These instructions are tested on Linux Mint 18 and should also work on close derivatives.
@@ -217,10 +165,6 @@ Download the source from GitHub:
217165

218166
$ git clone https://github.com/DataONEorg/d1_python.git
219167

220-
Set the `D1ROOT` environment variable to the location of `d1_python`. It's handy to set the variable in the startup script for your shell. E.g.,:
221-
222-
$ export D1ROOT=~/my/dev/d1_python
223-
224168
Add the DataONE packages to the Python path, and install their dependencies:
225169

226170
$ sh $D1ROOT/dev_tools/develop.sh
@@ -231,7 +175,6 @@ Run the following commands, except, change the "createuser" line to:
231175

232176
https://pythonhosted.org/dataone.generic_member_node/setup-local-postgresql.html
233177

234-
235178
Run the following commands (all sections), except, change the location for openssl.cnf, so the line that copies it becomes:
236179

237180
$ sudo cp /home/dahl/d1_python/d1_mn_generic/src/deployment/openssl.cnf .
@@ -242,12 +185,58 @@ Run the tests and verify that they all pass:
242185

243186
$ pytest
244187

188+
Set up credentials for working with the DataONE account on PyPI:
189+
190+
Edit `~/.pypirc`:
191+
192+
[server-login]
193+
username: dataone
194+
password: <secret>
195+
196+
### Creating a new release
197+
198+
The stack should pass all the tests with the most recent available versions of all the dependencies.
199+
200+
$ cd d1_python
201+
$ sudo ./dev_tools/src/d1_dev/pip-update-all.py
202+
203+
The DataONE Python stack specifies fixed versions of all its dependencies. This ensures that a stack deployed to production matches one that passed the tests. As updating the versions in the `setup.py` files manually is time consuming and error prone, a script is included that automates the task. The script updates the version information for the dependencies in the `setup.py` files to match the versions of the currently installed dependencies. Run the script with:
204+
205+
$ cd d1_python
206+
$ src-sync-dependencies.py . <version>
207+
208+
The `<version>` argument specifies what the version will be for the release. E.g., `"2.3.1"`. We keep the version numbers in sync between all of the packages in the d1_python git repository, so only one version string needs to be specified.
209+
210+
Check that there are no package version conflicts:
211+
212+
$ pip check
213+
214+
Some sample files contain the version tag and must be updated when the version changes.
215+
216+
$ pytest --sample-ask
217+
218+
Commit and push the changes, and check the build on Travis.
219+
220+
After successful build, clone a fresh copy, which will be used for building the release packages:
221+
222+
$ cd ~
223+
$ git clone [email protected]:DataONEorg/d1_python.git d1_python_build
224+
225+
Building the release packages from a fresh clone is a simple way of ensuring that only tracked files are released. It is a workaround for the way setuptools works, which is basically that it vacuums up everything that looks like a Python script in anything that looks like a package, which makes it easy to publish local files by accident.
226+
227+
Build and publish the packages:
228+
229+
cd ~/d1_python_build
230+
setup-all.py --root . bdist_wheel upload
231+
245232

246233
### Building the documentation
247234

235+
When `d1_python` is pushed to GitHub, a signal is sent by GitHub to [ReadTheDocs.org](https://readthedocs.org/), which automatically retrieves the new version of the project from GitHub, builds the documentation and makes it available at
248236

249-
TODO
237+
http://dataone-python.readthedocs.io/en/latest/
250238

239+
So it is not absolutely necessary to have a local build environment set up for the documentation, but building locally provides faster feedback when making changes that need to be checked before publishing.
251240

252241
### Troubleshooting
253242

client_cli/src/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def main():
2929
setuptools.setup(
3030
name='dataone.cli',
31-
version='2.3.2',
31+
version='2.3.3',
3232
description='Command-Line Interface (CLI) for DataONE',
3333
author='DataONE Project',
3434
author_email='[email protected]',
@@ -37,8 +37,8 @@ def main():
3737
packages=setuptools.find_packages(),
3838
include_package_data=True,
3939
install_requires=[
40-
'dataone.common == 2.3.2',
41-
'dataone.libclient == 2.3.2',
40+
'dataone.common == 2.3.3',
41+
'dataone.libclient == 2.3.3',
4242
#
4343
'requests == 2.18.1',
4444
],

client_onedrive/src/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
def main():
3333
setuptools.setup(
3434
name='dataone.onedrive',
35-
version='2.3.2',
35+
version='2.3.3',
3636
description='Filesystem access to the DataONE Workspace',
3737
author='DataONE Project',
3838
author_email='[email protected]',
@@ -41,8 +41,8 @@ def main():
4141
packages=setuptools.find_packages(),
4242
include_package_data=True,
4343
install_requires=[
44-
'dataone.common == 2.3.2',
45-
'dataone.libclient == 2.3.2',
44+
'dataone.common == 2.3.3',
45+
'dataone.libclient == 2.3.3',
4646
#
4747
'fusepy == 2.0.4',
4848
'pyxb == 1.2.5',

dev_tools/src/d1_dev/src-sync-dependencies.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ def main():
9191
except Exception as e:
9292
logging.error(str(e))
9393

94-
update_common_version_const(args.d1_version, args.show_diff)
94+
update_version_const(
95+
'd1_common', ['const.py'], args.d1_version, args.show_diff
96+
)
97+
update_version_const(
98+
'd1_gmn', ['version.py'], args.d1_version, args.show_diff
99+
)
95100

96101

97102
def update_deps_on_file(args, setup_path, show_diff, d1_version):
@@ -176,23 +181,19 @@ def get_package_version(package_name, d1_version):
176181
return pkg_resources.get_distribution(package_name).version
177182

178183

179-
def update_common_version_const(d1_version, only_diff):
180-
const_module_path = get_common_const_module_path()
181-
logging.info(
182-
'Updating VERSION in d1_common.const. path="{}"'.format(const_module_path)
183-
)
184-
r = d1_dev.util.redbaron_module_path_to_tree(const_module_path)
184+
def update_version_const(base_name, path_list, d1_version, only_diff):
185+
module_path = get_module_path(base_name, path_list)
186+
logging.debug('Updating version in module. path="{}"'.format(module_path))
187+
r = d1_dev.util.redbaron_module_path_to_tree(module_path)
185188
for n in r('AssignmentNode'):
186-
if n.target.value == 'VERSION':
189+
if n.target.value in ('VERSION', '__version__'):
187190
n.value.value = "'{}'".format(d1_version)
188-
d1_dev.util.update_module_file(
189-
r, const_module_path, only_diff, update=True
190-
)
191+
d1_dev.util.update_module_file(r, module_path, only_diff, update=True)
191192
break
192193

193194

194-
def get_common_const_module_path():
195-
return os.path.join(pkgutil.get_loader("d1_common").filename, 'const.py')
195+
def get_module_path(base_str, path_list):
196+
return os.path.join(pkgutil.get_loader(base_str).filename, *path_list)
196197

197198

198199
class UpdateException(Exception):

dev_tools/src/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
def main():
3030
setuptools.setup(
3131
name='dataone.dev',
32-
version='2.3.2',
32+
version='2.3.3',
3333
description='DataONE developer tools',
3434
author='DataONE Project',
3535
author_email='[email protected]',

gmn/src/d1_gmn/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
# See the License for the specific language governing permissions and
1919
# limitations under the License.
2020

21+
from .version import __version__ # noqa: F401
2122
default_app_config = 'd1_gmn.app.startup.GMNStartupChecks'

gmn/src/d1_gmn/app/views/internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def home(request):
5858
if request.path.endswith('/'):
5959
return HttpResponseRedirect(request.path[:-1])
6060

61-
gmn_version = d1_gmn.app.__version__
61+
gmn_version = d1_gmn.__version__
6262
django_version = ', '.join(map(str, django.VERSION))
6363

6464
n_science_objects = '{:,}'.format(

gmn/src/d1_gmn/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '2.3.3'

gmn/src/setup.py

100644100755
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727

2828

2929
def main():
30+
exec (open('d1_gmn/version.py').read())
31+
# noinspection PyUnresolvedReferences
3032
setuptools.setup(
3133
name='dataone.gmn',
32-
version='2.3.2',
34+
version='2.3.3',
3335
description='DataONE Generic Member Node (GMN)',
3436
author='DataONE Project',
3537
author_email='[email protected]',
@@ -41,9 +43,9 @@ def main():
4143
'': ['settings.py'],
4244
},
4345
install_requires=[
44-
'dataone.cli == 2.3.2',
45-
'dataone.common == 2.3.2',
46-
'dataone.libclient == 2.3.2',
46+
'dataone.cli == 2.3.3',
47+
'dataone.common == 2.3.3',
48+
'dataone.libclient == 2.3.3',
4749
#
4850
'django == 1.11.2',
4951
'iso8601 == 0.1.11',

lib_client/src/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def main():
2929
setuptools.setup(
3030
name='dataone.libclient',
31-
version='2.3.2',
31+
version='2.3.3',
3232
description='A DataONE client library for Python',
3333
author='DataONE Project',
3434
author_email='[email protected]',
@@ -37,7 +37,7 @@ def main():
3737
packages=setuptools.find_packages(),
3838
include_package_data=True,
3939
install_requires=[
40-
'dataone.common == 2.3.2',
40+
'dataone.common == 2.3.3',
4141
#
4242
'cachecontrol == 0.12.3',
4343
'pyxb == 1.2.5',

0 commit comments

Comments
 (0)