Skip to content

Commit

Permalink
HaikuTeam#1077: Added support of Python3 on top of Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jfthuong authored and danielnichols committed Apr 1, 2024
1 parent 9621235 commit e85b844
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ It's important to use precise minor version numbers where specified. `nodegit`/

$ curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0

4.) python 2.7.16 (if you need multiple Python environments on your machine, we recommend [pyenv](https://github.com/pyenv/pyenv))
4.) python 2.7 or 3.x (if you need multiple Python environments on your machine, we recommend [pyenv](https://github.com/pyenv/pyenv))

5.) libgcrypt (required for nodegit native bindings)
$ brew install libgcrypt
Expand All @@ -54,7 +54,7 @@ Assuming a clean Windows 10, open a PowerShell with admin rights:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install git
choco install git python2 -y
choco install git python -y
# Install nodejs
choco install nodejs-lts -y --version 8.15.1
Expand All @@ -81,7 +81,7 @@ yarn electron-rebuild
### Linux OS dependencies

* Install a desktop environment like Gnome, XFCE, or KDE if machine does not already have one
* Install dependences from system repositories: `apt install git curl python2 build-essential libgcrypt20 libcurl4-openssl-dev libssl-dev libgtk-3-0 libgconf-2-4 libnss3`
* Install dependences from system repositories: `apt install git curl python3 build-essential libgcrypt20 libcurl4-openssl-dev libssl-dev libgtk-3-0 libgconf-2-4 libnss3`
* Install nvm: `curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash`
* Install node 8.15.1: `nvm install 8.15.1 && nvm alias default 8.15.1 && nvm use 8.15.1`
* Install yarn 1.13.0: `curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0`
Expand Down
32 changes: 17 additions & 15 deletions hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python
import os
import sys
from os import environ
from os import path
import json
import subprocess

is_branch_checkout = sys.argv[3]
if is_branch_checkout == '0' or environ.get('SKIP_HAIKU_HOOKS', '0') == '1':
# This is a file checkout or we have been expliticly asked to do nothing.
sys.exit(0)
if is_branch_checkout == '0' or os.environ.get('SKIP_HAIKU_HOOKS', '0') == '1':
# This is a file checkout or we have been expliticly asked to do nothing.
sys.exit(0)

current_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
with open(path.join('packages', 'haiku-common', 'config', 'experiments.json')) as experiments_file:
experiments = json.load(experiments_file)
current_branch = subprocess.check_output(
['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
with open(os.path.join('packages', 'haiku-common', 'config', 'experiments.json')) as experiments_file:
experiments = json.load(experiments_file)

if sys.argv[1] != sys.argv[2]:
print 'Syncing dependencies....'
subprocess.call(['yarn', 'install'])
print('Syncing dependencies....')
subprocess.call(['yarn', 'install'])

print 'The following experiments are enabled:'
print '\n'.join([
' - {}'.format(experiment) for experiment in experiments if experiments.get(experiment, False)
])
print('The following experiments are enabled:')
print(
'\n'.join([
' - {}'.format(experiment) for experiment in experiments if experiments.get(experiment, False)
])
)
12 changes: 6 additions & 6 deletions hooks/post-merge
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python2.7
from os import environ
#!/usr/bin/env python
import os
import subprocess
import sys

if environ.get('SKIP_HAIKU_HOOKS', '0') == '1':
# We have been expliticly asked to do nothing.
sys.exit(0)
if os.environ.get('SKIP_HAIKU_HOOKS', '0') == '1':
# We have been expliticly asked to do nothing.
sys.exit(0)

print 'Syncing dependencies....'
print('Syncing dependencies....')
subprocess.call(['yarn', 'install'])

0 comments on commit e85b844

Please sign in to comment.