diff --git a/chapter1/chapter1.md b/chapter1/chapter1.md new file mode 100644 index 0000000..2ebcd8a --- /dev/null +++ b/chapter1/chapter1.md @@ -0,0 +1,51 @@ +# Chapter 1 + +## Prerequisites and setting up the environment + +### 1.1 Prerequisites - rerun experiments on latest versions + +Before we set out to understand the source code and design of python it is imperative that we +understand the setup of the system required. +Below are listed the prerequisites that are required to setup python on your machine. If you +already know how to compile python from source feel free to skip this section. +1. Linux based Operating System preferably Ubuntu version greater 12.04. All the +experiments were based on Ubuntu 12.04. +2. Python source code +(https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz) +3. Eclipse for C/C++ +(http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neon2) +4. gdb +5. make +Once you have this checklist ready we can proceed to setup python for debugging. + +### 1.2​ Setting up the environment + +Let us examine the steps for setting up eclipse and python for debugging. +1. Make a folder under your home directory and name it python-source. +(Example: /home/ubuntu/python-source). +2. Extract the contents of the python source code downloaded into the folder +using the command $tar -xvzf + +3. Enter the folder in the command line using the command $cd +python-source. +4. Type the command $ ./configure –with-pydebug to enable debugging of +the source code. +5. When the command completes without errors enter the next command +$make -j8. Where 8 is the number of CPU cores. This could vary on your +system. Type the appropriate number. +6. Open Eclipse and create a new C/C++ project and name it python-source. +7. Select Import in Eclipse menu as shown in the pictures below. +![](https://raw.githubusercontent.com/yashasingh/internalsofcpython36book/chapter1/chapter1/img1.png) +![](https://raw.githubusercontent.com/yashasingh/internalsofcpython36book/chapter1/chapter1/img2.png) + +8. Complete the wizard by selecting the folder from the menu and the project +to import to as python-source. +9. Select the Run Menu and then select Debug Configurations to open the +debug menu as shown below. +10. ![](https://raw.githubusercontent.com/yashasingh/internalsofcpython36book/chapter1/chapter1/img3.png) +11. Select the python executable as shown below. +12. ![](https://raw.githubusercontent.com/yashasingh/internalsofcpython36book/chapter1/chapter1/img4.png) +13. Click on the debug option and you must see the python shell in the +debug menu. +![](https://raw.githubusercontent.com/yashasingh/internalsofcpython36book/chapter1/chapter1/img5.png) +You are ready to go. diff --git a/chapter1/img1.png b/chapter1/img1.png new file mode 100644 index 0000000..be8fe20 Binary files /dev/null and b/chapter1/img1.png differ diff --git a/chapter1/img2.png b/chapter1/img2.png new file mode 100644 index 0000000..6faeefe Binary files /dev/null and b/chapter1/img2.png differ diff --git a/chapter1/img3.png b/chapter1/img3.png new file mode 100644 index 0000000..a2fb65a Binary files /dev/null and b/chapter1/img3.png differ diff --git a/chapter1/img4.png b/chapter1/img4.png new file mode 100644 index 0000000..a2fb65a Binary files /dev/null and b/chapter1/img4.png differ diff --git a/chapter1/img5.png b/chapter1/img5.png new file mode 100644 index 0000000..0b6df51 Binary files /dev/null and b/chapter1/img5.png differ