Skip to content

Commit

Permalink
Cleaned up functionality to make it work both on linux and mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathf committed Nov 2, 2016
1 parent c4cd392 commit 2fa2b61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ If you *do* want to reinstall an environment, this is also possible::

In addition, if if is possible to use ``enw`` to install a suite of standard
packages. By including a ``-i`` flag, ``enw`` will look for the file
``.enw`` recursivly in the current directory and bellow and install its content
using ``pip install -r``, using the newly installed virtual environment. Like
``autoenv`` it will install in order from lowest directories to the highest.
``.enw`` recursivly in the current directory and bellow it (much like
``autoenv``) and install its content using ``pip install -r``, using the newly
installed virtual environment.
15 changes: 5 additions & 10 deletions enw/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def adjust_autoenv(pypath):

def pip_install(pypath):
"""
Pip install default programs from `.enwrc` file if it exists.
Pip install default programs from `.enw` file if it exists.
Args:
pypath (str) : path to the python virtual enviroment folder.
"""
pippath = os.path.join(pypath, "bin", "pip")
pippath = os.path.abspath(os.path.join(pypath, "bin", "pip"))

cmd = "%s install -U pip" % pippath
print(cmd)
Expand All @@ -72,7 +72,7 @@ def pip_install(pypath):
with open(rcfile) as src:
lines = src.readlines()
for line in lines:
cmd = "%s install -r %s" % (pippath, line)
cmd = "%s install %s" % (pippath, line)
print(cmd)
os.system(cmd)

Expand All @@ -86,13 +86,8 @@ def run_args(version=3, force=False, install_pip=False, **kwargs):
Args:
version (int, float) : The python version number to one decimal.
force (bool) : Override old python enviroment if exist.
install_pip (bool) : Install programs with pip from `~/.enwrc`.
install_pip (bool) : Install programs with pip from `~/.enw`.
"""
# run outside env:
if os.environ.get("VIRTUAL_ENV", ""):
os.system("deactivate && " + " ".join(sys.argv))
sys.exit(0)

if version == int(version):
version = "%d" % version
else:
Expand Down Expand Up @@ -125,7 +120,7 @@ def set_args(parser):
)
parser.add_argument(
"-i", "--install-pip", action="store_true",
help="install packages from `~/.enwrc`"
help="install packages from `~/.enw`"
)
parser.add_argument(
"version", type=float, nargs="?", default=3,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="enw",
version="0.2",
version="0.4",
packages=find_packages(),
entry_points={
'console_scripts': [
Expand Down

0 comments on commit 2fa2b61

Please sign in to comment.