Skip to content

Commit

Permalink
working conda build (failing test, due to auth)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Bollweg committed Jan 18, 2016
1 parent dd155c4 commit 5df7fd8
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 53 deletions.
5 changes: 1 addition & 4 deletions .binstar.yml
Expand Up @@ -13,10 +13,7 @@ engine:
- python=3.5

install:
- conda build conda.recipe -c anaconda-notebook
- conda build conda.recipe -c anaconda-notebook -c javascript -c mutirri -c jakirkham -c bokeh
- conda install nb_anacondacloud --use-local -c anaconda-notebook

test:
- python -m unittest discover

build_targets: conda
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -10,3 +10,5 @@ dist/
node_modules/
*.xunit.xml
npm-debug.log
.jupyter-jstest.log
screenshots/
2 changes: 1 addition & 1 deletion conda.recipe/bld.bat
@@ -1,2 +1,2 @@
"%PYTHON%" setup.py install
"%PREFIX%/bin/python" setup.py install
if errorlevel 1 exit 1
2 changes: 1 addition & 1 deletion conda.recipe/build.sh
@@ -1,2 +1,2 @@
#!/bin/bash
$PYTHON setup.py install
"${PREFIX}/bin/python" setup.py install
24 changes: 24 additions & 0 deletions conda.recipe/meta.yaml
Expand Up @@ -2,6 +2,10 @@ package:
name: nb_anacondacloud
version: 0.1.1

build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
string: py{% if environ.get('GIT_DESCRIBE_NUMBER', '0') == '0' %}{{ environ.get('PY_VER').replace('.', '') }}_0{% else %}{{ environ.get('PY_VER').replace('.', '') }}_{{ environ.get('GIT_BUILD_STR', 'GIT_STUB') }}{% endif %}

requirements:
build:
- anaconda-client
Expand All @@ -14,6 +18,26 @@ requirements:
- nbsetuptools
- notebook
- pyyaml
- python

test:
files:
- package.json
requires:
- anaconda-client
- coverage
- flake8
- funcsigs
- mock
- nb_config_manager
- nbsetuptools
- nodejs
- nose
- notebook
- notebook
- python
- pyyaml
- requests

source:
path: ../
Expand Down
15 changes: 15 additions & 0 deletions conda.recipe/package.json
@@ -0,0 +1,15 @@
{
"name": "nb_anacondacloud-conda-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "python -m nose nb_anacondacloud"
},
"author": "",
"license": "ISC",
"devDependencies": {
"casperjs": "^1.1.0-beta3",
"phantomjs": "*"
}
}
1 change: 1 addition & 0 deletions conda.recipe/run_test.bat
@@ -0,0 +1 @@
"%PREFIX%/bin/python" -m nose nb_anacondacloud
2 changes: 2 additions & 0 deletions conda.recipe/run_test.sh
@@ -0,0 +1,2 @@
"${PREFIX}/bin/npm" install
"${PREFIX}/bin/npm" run test
57 changes: 10 additions & 47 deletions nb_anacondacloud/tests/test_notebook.py
Expand Up @@ -56,14 +56,15 @@ def cleanup(self):
super(NBAnacondaCloudTestController, self).cleanup()

def _init_server(self):
# copy current user token into the temp directory
home = os.environ["HOME"]
_data_dir = "".join([self.home.name, dirs.user_data_dir[len(home):]])

shutil.copytree(
dirs.user_data_dir,
_data_dir
)
# TODO:
# NOT TODO: copy current user token into the temp directory
# home = os.environ["HOME"]
# _data_dir = "".join([self.home.name, dirs.user_data_dir[len(home):]])
#
# shutil.copytree(
# dirs.user_data_dir,
# _data_dir
# )

with patch.dict(os.environ, self.env):
subprocess.check_call([
Expand All @@ -74,45 +75,7 @@ def _init_server(self):
"--prefix", self.config_dir.name,
])

self.env.update(NB_ANACONDACLOUD_TEST="MOCK_ALL")

# copied from notebook 4.1
self.server_command = command = [
sys.executable,
'-m', 'notebook',
'--no-browser',
'--debug',
'--notebook-dir', self.nbdir.name,
'--NotebookApp.base_url=%s' % self.base_url,
# """--NotebookApp.server_extensions=["%s"]""" % (
# "nb_anacondacloud.nbextension"),
# """--NotebookApp.config_manager_class=%s""" % (
# "nb_config_manager.EnvironmentConfigManager"),
]
# ipc doesn't work on Windows, and darwin has crazy-long temp paths,
# which run afoul of ipc's maximum path length.
if sys.platform.startswith('linux'):
command.append('--KernelManager.transport=ipc')
self.stream_capturer = c = jstest.StreamCapturer()
c.start()
env = os.environ.copy()
env.update(self.env)
if self.engine == 'phantomjs':
env['IPYTHON_ALLOW_DRAFT_WEBSOCKETS_FOR_PHANTOMJS'] = '1'
self.server = subprocess.Popen(
command,
stdout=c.writefd,
stderr=subprocess.STDOUT,
cwd=self.nbdir.name,
env=env,
)
with patch.dict('os.environ', {'HOME': self.home.name}):
runtime_dir = jstest.jupyter_runtime_dir()
self.server_info_file = os.path.join(
runtime_dir,
'nbserver-%i.json' % self.server.pid
)
self._wait_for_server()
super(NBAnacondaCloudTestController, self)._init_server()


def prepare_controllers(options):
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"test": "python setup.py nosetests",
"pkg:conda": "conda build conda.recipe -c anaconda-notebook -c javascript -c mutirri -c jakirkham -c bokeh",
"lint": "eslint nb_anacondacloud/tests/js nb_anacondacloud/static && flake8 setup.py nb_anacondacloud"
},
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -8,5 +8,7 @@
description="Integration with Anaconda-Cloud",
long_description=open('README.md').read(),
packages=setuptools.find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=['anaconda-client']
)

0 comments on commit 5df7fd8

Please sign in to comment.