diff --git a/examples/working-example-project/activate b/examples/working-example-project/activate new file mode 100644 index 00000000..a30f64ec --- /dev/null +++ b/examples/working-example-project/activate @@ -0,0 +1,78 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + unset -f pydoc >/dev/null 2>&1 + + # reset old environment variables + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all + if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then + PATH="$_OLD_VIRTUAL_PATH" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then + hash -r 2>/dev/null + fi + + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then + PS1="$_OLD_VIRTUAL_PS1" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + if [ ! "${1-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV="/home/prasad.kudale/mig-v2/kite/kite-python/build/venv" +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +if ! [ -z "${PYTHONHOME+_}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then + _OLD_VIRTUAL_PS1="$PS1" + if [ "x(kite-python)" != x ] ; then + PS1="(kite-python)$PS1" + else + PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1" + fi + export PS1 +fi + +# Make sure to unalias pydoc if it's already there +alias pydoc 2>/dev/null >/dev/null && unalias pydoc + +pydoc () { + python -m pydoc "$@" +} + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then + hash -r 2>/dev/null +fi diff --git a/examples/working-example-project/build.gradle b/examples/working-example-project/build.gradle new file mode 100644 index 00000000..0d9a5d0a --- /dev/null +++ b/examples/working-example-project/build.gradle @@ -0,0 +1,51 @@ +buildscript { + dependencies { + classpath "gradle.plugin.com.linkedin.pygradle:pygradle-plugin:+" + } + repositories { + /** + * Repository for gradle.plugin.com.linkedin.pygradle:pygradle-plugin plugin + */ + maven { + url "https://plugins.gradle.org/m2/" + } + } +} + +repositories { + /** + * created the local pypi repository + */ + ivy { + name 'pypi-repo' + url "pypi-repo/" + layout 'pattern', { + artifact '[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]' + ivy '[organisation]/[module]/[revision]/[module]-[revision].ivy' + } + } +} + +apply plugin: "idea" +apply plugin: 'com.linkedin.python' +tasks.flake8.enabled(false) +tasks.installProject.enabled(false) +tasks.pytest.dependsOn(':examples:working-example-project:pipInstallRequirements') + +python { + testDir = file('test') +} +dependencies { + python 'pypi:requests:2.9.1' + python 'pypi:pyflakes:2.4.0' + test 'pypi:mock:4.0.3' +} + + +task pipInstallRequirements(type: Exec) { + commandLine "bash", "-c", "source ../../build/examples/working-example-project/venv/bin/activate && ../../build/examples/working-example-project/venv/bin/pip3 install -r requirements.txt && deactivate" +} + +task runTests(type: Exec) { + commandLine "bash", "./runTests.sh" +} diff --git a/examples/working-example-project/pinned.txt b/examples/working-example-project/pinned.txt new file mode 100644 index 00000000..b3e285d0 --- /dev/null +++ b/examples/working-example-project/pinned.txt @@ -0,0 +1,2 @@ +requests==2.9.1 +pyflakes==2.4.0 diff --git a/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.ivy b/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.ivy new file mode 100644 index 00000000..34fcce9a --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.tar.gz b/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.tar.gz new file mode 100644 index 00000000..f3bca4ca Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/Sphinx/1.8.1/Sphinx-1.8.1.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.ivy b/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.ivy new file mode 100644 index 00000000..a589d64d --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.tar.gz new file mode 100644 index 00000000..84907819 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/flake8/3.6.0/flake8-3.6.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.ivy b/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.ivy new file mode 100644 index 00000000..dd14eb0f --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.tar.gz b/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.tar.gz new file mode 100644 index 00000000..aa9979a4 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/mock/4.0.3/mock-4.0.3.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.ivy b/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.ivy new file mode 100644 index 00000000..4d6399b6 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.tar.gz b/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.tar.gz new file mode 100644 index 00000000..5c9e8ebe Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pex/1.5.2/pex-1.5.2.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.ivy b/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.ivy new file mode 100644 index 00000000..66a82032 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.tar.gz b/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.tar.gz new file mode 100644 index 00000000..a18192d0 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pip/18.1/pip-18.1.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.ivy b/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.ivy new file mode 100644 index 00000000..db25c195 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.tar.gz new file mode 100644 index 00000000..8316a14c Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pyflakes/2.4.0/pyflakes-2.4.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.ivy b/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.ivy new file mode 100644 index 00000000..ecd2449f --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.tar.gz new file mode 100644 index 00000000..793e4ede Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pytest-cov/2.6.0/pytest-cov-2.6.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.ivy b/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.ivy new file mode 100644 index 00000000..9627b9ac --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.tar.gz new file mode 100644 index 00000000..93524797 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pytest-xdist/1.24.0/pytest-xdist-1.24.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.ivy b/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.ivy new file mode 100644 index 00000000..d42c553c --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.tar.gz new file mode 100644 index 00000000..86022074 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/pytest/3.10.0/pytest-3.10.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.ivy b/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.ivy new file mode 100644 index 00000000..43be2ee3 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.tar.gz b/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.tar.gz new file mode 100644 index 00000000..f7a43acb Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/requests/2.9.1/requests-2.9.1.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.ivy b/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.ivy new file mode 100644 index 00000000..43ce0284 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.tar.gz b/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.tar.gz new file mode 100644 index 00000000..28a6d78a Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/setuptools-git/1.2/setuptools-git-1.2.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.ivy b/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.ivy new file mode 100644 index 00000000..4c196b1e --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.zip b/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.zip new file mode 100644 index 00000000..e7ffa46e Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/setuptools/40.5.0/setuptools-40.5.0.zip differ diff --git a/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.ivy b/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.ivy new file mode 100644 index 00000000..af21b5f5 --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.tar.gz b/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.tar.gz new file mode 100644 index 00000000..98b35c75 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/virtualenv/16.0.0/virtualenv-16.0.0.tar.gz differ diff --git a/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.ivy b/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.ivy new file mode 100644 index 00000000..48d1bf6e --- /dev/null +++ b/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.ivy @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.tar.gz b/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.tar.gz new file mode 100644 index 00000000..d44edd46 Binary files /dev/null and b/examples/working-example-project/pypi-repo/pypi/wheel/0.31.1/wheel-0.31.1.tar.gz differ diff --git a/examples/working-example-project/readme.md b/examples/working-example-project/readme.md new file mode 100644 index 00000000..00327873 --- /dev/null +++ b/examples/working-example-project/readme.md @@ -0,0 +1,9 @@ +1. Clone the whole project. +2. add below lines to `settings.gradle` + + `include ':examples'` + + `include ':examples:working-example-project'` + +3. Then run `../../gradlew build` command. +4. Yo! You've successfully built the **`pygradle`** project diff --git a/examples/working-example-project/requirements.txt b/examples/working-example-project/requirements.txt new file mode 100644 index 00000000..eeb80577 --- /dev/null +++ b/examples/working-example-project/requirements.txt @@ -0,0 +1,44 @@ +atomicwrites==1.4.0 +attr==0.3.1 +attrs==21.2.0 +flake8==3.6.0 +importlib-metadata==4.8.2 +pex==1.5.2 +pluggy==1.0.0 +py==1.11.0 +pyflakes==2.4.0 +pytest==3.10.0 +pytest-cov==2.6.0 +pytest-xdist==1.24.0 +requests==2.9.1 +setuptools-git==1.2 +six==1.16.0 +Sphinx==1.8.1 +typing-extensions==4.0.1 +zipp==3.6.0 +alabaster==0.7.12 +Babel==2.9.1 +coverage==6.2 +docutils==0.18.1 +execnet==1.9.0 +imagesize==1.3.0 +importlib-metadata==4.8.2 +Jinja2==3.0.3 +MarkupSafe==2.0.1 +mccabe==0.6.1 +mock==4.0.3 +more-itertools==8.12.0 +packaging==21.3 +pex==1.5.2 +pluggy==1.0.0 +py==1.11.0 +pycodestyle==2.4.0 +Pygments==2.10.0 +pyparsing==3.0.6 +pytest-forked==1.4.0 +pytz==2021.3 +snowballstemmer==2.2.0 +sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-websupport==1.2.4 +typing-extensions==4.0.1 + diff --git a/examples/working-example-project/runTests.sh b/examples/working-example-project/runTests.sh new file mode 100644 index 00000000..f39f94be --- /dev/null +++ b/examples/working-example-project/runTests.sh @@ -0,0 +1,6 @@ +#! /bin/bash +command -v source >/dev/null 2>&1 || { + echo "I require source but it's not installed. Aborting." >&2; exit 1; +} +source activate +pytest -v --cov --cov-report html \ No newline at end of file diff --git a/examples/working-example-project/setup.cfg b/examples/working-example-project/setup.cfg new file mode 100644 index 00000000..4dba5922 --- /dev/null +++ b/examples/working-example-project/setup.cfg @@ -0,0 +1 @@ +[flake8] \ No newline at end of file diff --git a/examples/working-example-project/setup.py b/examples/working-example-project/setup.py new file mode 100644 index 00000000..4821dc94 --- /dev/null +++ b/examples/working-example-project/setup.py @@ -0,0 +1,151 @@ +# +# Copyright 2016 LinkedIn Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from __future__ import print_function + +import os +import sys +import pkg_resources +import platform + +from setuptools import setup, find_packages, Command +from setuptools.command.install_egg_info import install_egg_info as _install_egg_info +from setuptools.dist import Distribution + + +class EntryPoints(Command): + description = 'get entrypoints for a distribution' + user_options = [ + ('dist=', None, 'get entrypoints for specified distribution'), + ] + + def initialize_options(self): + self.dist = self.distribution.get_name() + + def finalize_options(self): + """Abstract method that is required to be overwritten""" + + def run(self): + req_entry_points = pkg_resources.get_entry_map(self.dist) + if req_entry_points and 'console_scripts' in req_entry_points: + for entry in list(req_entry_points['console_scripts'].values()): + print(entry, file=sys.stdout) + + +class install_egg_info(_install_egg_info): # noqa + """Override the setuptools namespace package templates. + + Customizes the "nspkg.pth" files so that they're compatible with + "--editable" packages. + + See this pip issue for details: + + https://github.com/pypa/pip/issues/3 + + Modifications to the original implementation are marked with CHANGED + + """ + _nspkg_tmpl = ( + # CHANGED: Add the import of pkgutil needed on the last line. + "import sys, types, os, pkgutil", + "p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r)", + "ie = os.path.exists(os.path.join(p, '__init__.py'))", + "m = not ie and " + "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))", + "mp = (m or []) and m.__dict__.setdefault('__path__', [])", + "(p not in mp) and mp.append(p)", + # CHANGED: Fix the resulting __path__ on the namespace packages to + # properly traverse "--editable" packages too. + "mp[:] = m and pkgutil.extend_path(mp, %(pkg)r) or mp", + ) + "lines for the namespace installer" + + _nspkg_tmpl_multi = ( + # CHANGED: Use "__import__" to ensure the parent package has been + # loaded before attempting to read it from sys.modules. + # This avoids a possible issue with nested namespace packages where the + # parent could be skipped due to an existing __init__.py file. + 'm and __import__(%(parent)r) and setattr(sys.modules[%(parent)r], %(child)r, m)', + ) + "additional line(s) when a parent package is indicated" + + +class GradleDistribution(Distribution, object): + + PINNED_TXT = 'pinned.txt' + + excluded_platform_packages = {} + + def __init__(self, attrs): + attrs['name'] = os.getenv('PYGRADLE_PROJECT_NAME') + attrs['version'] = os.getenv('PYGRADLE_PROJECT_VERSION') + attrs['install_requires'] = list(self.load_pinned_deps()) + super(GradleDistribution, self).__init__(attrs) + + def get_command_class(self, command): + """Return a customized command class or the base one.""" + if command == 'install_egg_info': + return install_egg_info + elif command == 'entrypoints': + return EntryPoints + + return super(GradleDistribution, self).get_command_class(command) + + @property + def excluded_packages(self): + platform_name = platform.system().lower() + if platform_name in self.excluded_platform_packages: + return set(pkg.lower() for pkg in self.excluded_platform_packages[platform_name]) + return set() + + def load_pinned_deps(self): + """Load a pinned.txt file. + + The pinned.txt file contains a list of dependencies that this Python + project depends on. Although the PyGradle build system will ignore this + file and never install dependencies declared via this method, it is + important to declare the dependencies using this method to maintain + backwards compatibility with non-PyGradle build systems. + + """ + # calculate this only once + blacklisted = self.excluded_packages + try: + reqs = [] + with open(self.PINNED_TXT) as fh: + reqs = fh.readlines() + # Don't include the version information so that we don't mistakenly + # introduce a version conflict issue. + for req in reqs: + if req: + name, version = req.split('==') + if name and name.lower() not in blacklisted: + yield name + except IOError: + raise StopIteration + +#setup( +# distclass=GradleDistribution, +# package_dir={'': 'src'}, +# packages=find_packages('src'), +# include_package_data=True, +# +# entry_points={ +# 'console_scripts': [ +# 'hello_world = foo.hello:main', +# ], +# } +#) diff --git a/examples/working-example-project/src/foo.py b/examples/working-example-project/src/foo.py new file mode 100644 index 00000000..0b4d5124 --- /dev/null +++ b/examples/working-example-project/src/foo.py @@ -0,0 +1,2 @@ +def hello_world(): + return "hello world!" diff --git a/examples/working-example-project/test/__init__.py b/examples/working-example-project/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/working-example-project/test/foo_test.py b/examples/working-example-project/test/foo_test.py new file mode 100644 index 00000000..cad311f3 --- /dev/null +++ b/examples/working-example-project/test/foo_test.py @@ -0,0 +1,12 @@ +import unittest + +from src import foo + + +class MyTestCase(unittest.TestCase): + def test_print_hello_world(self): + self.assertEqual(foo.hello_world(), "hello world!") # add assertion here + + +if __name__ == '__main__': + unittest.main()